ReaderWriterLock write order

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

If there are multiple threads that make calls to
ReaderWriterLock.AcquireWriterLock(x), clearly all but one will be
blocked at any time.

Is the order at which the threads acquire lock (as the previous one
releases) the same order that the threads called AcquireWriterLock in
the first place (e.g. the second thread to call AcquireWriterLock will
be the second to acquire the lock, and so on, like a FIFO?)

Secondly, why isn' this in the documentation? (or did I miss it?)

Many thanks for any assistance

Tom
 
[...]
Is the order at which the threads acquire lock (as the previous one
releases) the same order that the threads called AcquireWriterLock in
the first place (e.g. the second thread to call AcquireWriterLock will
be the second to acquire the lock, and so on, like a FIFO?)

Secondly, why isn' this in the documentation? (or did I miss it?)

I don't see anything that I'd call unambiguously explicit. But the
discussion in the main class page
(http://msdn2.microsoft.com/en-us/library/system.threading.readerwriterlock.aspx)
talks about reader and writer queues, which suggests to me that it's a
FIFO operation.

I should probably install Reflector some day. I hear it's useful for
looking at this sort of implementation detail. I don't have first-hand
knowledge of it, but it seems likely you could use Reflector to get a
more reliable answer.

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top