Mislim da sam malo brzopleto napisao da su monitor::pulse() i monitor::wait() resenje mog problema. Pogledao sam ove linkove gore i konsultovao neku literaturu i mislim da to nece moci da prodje jer ove dve metode moraju da se koriste unutar sinhronizovanog bloka, tj. unutar Monitor::Enter() i Monitor::Exit(). Meni je ovde potrebno da jedna nit signalizira drugoj niti koja ceka da se dogodi neki uslov da moze da se odblokira.
Naisao sam na MSDN na AutoResetEvent i ManualResetEvent i mislim da je to, ali nikako da provalim kako se koriste ove metode Set(),WaitOne(), i Reset(). Uvek mi se niti blokiraju i nemogu da ih ponovo odblokiram sa Set().
Da li neko zna kako se koriste ovi tipovi i da li je to ono sto meni treba?
Evo sta na MSDN pise za ove tipove:
ManualResetEvent allows threads to communicate with each other by signaling. Typically, this communication concerns a task which one thread must complete before other threads can proceed.
When a thread begins an activity that must complete before other threads proceed, it calls Reset to put ManualResetEvent in the nonsignaled state. This thread can be thought of as controlling the ManualResetEvent. Threads that call WaitOne on the ManualResetEvent will block, awaiting the signal. When the controlling thread completes the activity, it calls Set to signal that the waiting threads can proceed. All waiting threads are released.
Once it has been signaled, ManualResetEvent remains signaled until it is manually reset. That is, calls to WaitOne return immediately.
You can control the initial state of a ManualResetEvent by passing a Boolean value to the constructor, true if the initial state is signaled and false otherwise.
ManualResetEvent can also be used with the static (Shared in Visual Basic) WaitAll and WaitAny methods.
For more information about thread synchronization mechanisms, see ManualResetEvent in the conceptual documentation
http://msdn.microsoft.com/libr...nualreseteventmemberstopic.asp