If there are multiple threads all waiting on the same lock is it possible to have the Main thread have higher priority in acquiring the lock. Meaning that if worker threads go to the lock statement before the main thread, the main thread would acquire the lock before the other threads that were already waiting on it.
If there are multiple threads all waiting on the same lock is it possible
Share
No, the
lockstatement maps toSystem.Threading.Monitor.Enter()(MSDN) and there is no overload that accepts a priority parameter.The closest thing I can think of is a ReaderWriterLock(Slim) but I would seriously reconsider the design that leads to this request. There probably are better ways to achieve what you need.