Re: Mutex wait order
On Wed, 2 Aug 2006 23:59:46 +0200, "Arnaud Debaene"
<adebaene@club-internet.fr> wrote:
As I read it, a thread can be put outside of FIFO order only by an APC, and
therefore it knows when it does so (by calling a wait function that put it
in an alertable wait state - WaitForSinghleObjectEx for example).
Sure, a kernel mode APC could be posted to the thread anytime, but I believe
it can be done only when the thread has itself intiated an action (ie, an
I/O request) that cause a driver to post this APC. Could a kernel mode guru
confirm?
See Raymond's blog entry:
PulseEvent is fundamentally flawed
http://blogs.msdn.com/oldnewthing/archive/2005/01/05/346888.aspx
He talks about the kernel and device drivers "borrowing" threads to process
kernel mode APCs, but he doesn't go into a lot of detail on this
"borrowing" business. This reply sheds some more light, but the list it
gives doesn't sound exhaustive:
http://blogs.msdn.com/oldnewthing/archive/2005/01/05/346888.aspx#347500
It does appear that other threads can cause this reordering to happen to a
waiting thread, though. Anyway, the thrust of that reply seems to be,
"Fairness, shmairness, we like scalability more," so I guess there's my
answer. :)
--
Doug Harrison
Visual C++ MVP