> If I have some c++ class exported from a Win32 dll, and from some other
> console application I created two threads and each thread creates an
[quoted text clipped - 6 lines]
> WaitForSingleObject it can continue event if the other thread still
> blocked on its instance?
The threads wait on the object referred to by the HANDLE that you passed to
WFSO to become signaled or for the timeout interval you specified to
expire. Exactly what happens when the handle becomes signaled depends on
the type of the sync object. For example, only one thread is allowed to
acquire a mutex and progress, while the rest remain blocked (modulo
non-INFINITE timeout values) until that thread releases it (or terminates,
in which case it "abandons" the mutex), at which point, another thread can
acquire the mutex.

Signature
Doug Harrison
Microsoft MVP - Visual C++
ramialhasan - 18 May 2005 21:34 GMT
Sorry but I mean that the two threads are calling the same method but
from different instances and each instance has its own copy of the sync
object. so they are not waiting on the same event but on different
evemts. But my question is related to DLL processing, so if one thread
is waiting on its own event is the other instances blocked two until
the waiting is released or each thread runs in its own processing
thread?
Regards,
Rami
Scott McPhillips [MVP] - 18 May 2005 22:26 GMT
> Sorry but I mean that the two threads are calling the same method but
> from different instances and each instance has its own copy of the sync
[quoted text clipped - 5 lines]
> Regards,
> Rami
Each thread runs independently. If each thread is using a different
sync object they do not affect each other.

Signature
Scott McPhillips [VC++ MVP]
Doug Harrison [MVP] - 18 May 2005 23:47 GMT
> Sorry but I mean that the two threads are calling the same method but
> from different instances and each instance has its own copy of the sync
[quoted text clipped - 3 lines]
> the waiting is released or each thread runs in its own processing
> thread?
I'm not sure what you think is special about DLLs. They're pretty much just
chunks of code and data loaded into your process's address space, though
the system does serialize the execution of DllMain functions. As for your
sync objects, if the HANDLEs you pass to WFSO refer to different sync
objects, no synchronization occurs between the two threads when they call
WFSO on their respective HANDLEs. They run independently of one another.

Signature
Doug Harrison
Microsoft MVP - Visual C++
ramialhasan - 19 May 2005 16:06 GMT
Thanks for you all, now this is clear