threading monitor
Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance
Background:
Upon receiving a Monitor.Pulse, the waiting thread is moved to the ready
queue. When the thread that invoked Monitor.Pulse releases the lock, the
next thread in the ready queue (which is not necessarily the thread that was
pulsed) acquires the lock.
How can a ensure that the waiting thread gets priority in acquiring the lock
over others in the waiting queue?
I need the waiting thread to be the one next in line to acquire the lock
after any Pulse from any other thread.
Thanks
Perry
.
Relevant Pages
- threading monitor
... Upon receiving a Monitor.Pulse, the waiting thread is moved to the ready ... When the thread that invoked Monitor.Pulse releases the lock, ... next thread in the ready queue (which is not necessarily the thread that was ... How can I ensure that the waiting thread gets priority in acquiring the lock ... (microsoft.public.dotnet.languages.vb) - Re: Seeing lock order reversal
... 21 vm page queue free mutex -- ... 18 UMA zone -- ... 18 sleep mtxpool -- ... 15 process lock -- ... (freebsd-current) - Re: location of bioq lock
... queue is owned by the driver, and the locking scheme remains the same. ... from a different scheduler than the default, it can be easily plugged in. ... process you have to lock each queue before playing with it. ... (freebsd-current) - Re: thread communication
... I changed this into a simple class which has a SyncRoot which I can Wait and Pulse, and then some code to process the queue. ... One thing I noticed in your code though, in your desire to move the actual processing outside of the lock, you have introduced an inefficiency in the synchronization. ... IFileProcessor processor = Queue.Dequeue; ... Especially with the above alternative, you could easily maintain a local Queue to which all of the public Queue elements are copied, and then just loop while unlocked until the local Queue is empty, adding the "ready" items back into the local Queue as you find them. ... (microsoft.public.dotnet.languages.csharp) - Re: thread-safety
... but that would depend on the implementation of your Queue class. ... lock { ... It's odd for you to be passing a WaitHandle of any sort to the Monitor class; if you've got a WaitHandle, you would normally just wait on _that_, rather than using the WaitHandle simply as a synchronization object for Monitor. ... It would be a problem to call Monitor.Pulseif no other thread is waiting at a call to Monitor.Wait, because then the waiting thread would miss the Pulse. ... (microsoft.public.dotnet.languages.csharp) |
|