A monitor for every object

Robert Jacques sandford at jhu.edu
Fri Feb 4 15:53:19 PST 2011


On Fri, 04 Feb 2011 17:23:35 -0500, Jérôme M. Berger <jeberger at free.fr>  
wrote:

> Steven Schveighoffer wrote:
>> D's monitors are lazily created, so there should be no issue with
>> resource allocation.
> 	What happens if two threads attempt to create a monitor for the
> same object at the same time? Is there a global lock to avoid race
> conditions in this case?
>
> 		Jerome

Only the reference to the mutex is shared, so all you need in an atomic op.


More information about the Digitalmars-d mailing list