Re: JavaMemoryModel: Some C# thread code

From: David Holmes (dholmes@dstc.edu.au)
Date: Sun Jul 30 2000 - 22:46:40 EDT


> Still leaves a lot of questions open. For example, does the WaitOne
> call to a ManualResetEvent release locks? If so, which locks?

Events are self-contained synchronization objects that are not explicitly
associated with external "locks". When you wait on a manual reset event you
will wait until the event becomes signalled, while you were waiting (well
that's the basic action of wait for all events - manual reset or
auto-reset). If you think of events as if they were condition variables then
they seems "broken" because you get "lost wakeups" etc - but they are not
CV's and you use them differently. You combine Events with "locks" using
methods like "signalObjectAndWait" that allows you to atomically "release" a
lock object and wait on the event object.

This is the win32 synchronization model - I don't know if they have changed
it for C# but I'm assuming they just provide wrapper objects.

David

-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel



This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:27 EDT