[dmd-concurrency] Defining shared delegates
Michel Fortin
michel.fortin at michelf.com
Tue Jan 19 12:27:05 PST 2010
Le 2010-01-19 à 15:18, Andrei Alexandrescu a écrit :
> Michel Fortin wrote:
>> - If the data carried by the delegate is thread-local, in whole or in part, then the delegate is thread-local.
>
> I haven't thought much about shared delegates, but on the face of it this doesn't work. A delegate may increment an ostensibly thread-local variable and return it. Then, the delegate may be passed to several threads. Race ensues.
Are you reading things in reverse?
What you quoted says that if the delegate references a thread-local variable it can't be shared. If it can't be shared it can't be sent to other threads.
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the dmd-concurrency
mailing list