Let\'s say I have the following code
static class ...
{
static object myobj = new object();
static void mymethod()
{
lock(myobj)
Windows and the CLR attempt their best to guarantee the fairness (the FIFO order) of the waiting. However, there are certain scenarios where the order of the threads waiting on a lock can be changed, mostly revolving around alertable waits and all CLR thread locking puts the thread in alertable state.
For all practical purposes, you can assume that the order will be FIFO; however, be aware of this issue.