Monitor.Enter
and Monitor.Exit
are designed to be called from the same thread. But, what if I need to release a lock in a different thread than acq
Try using a ManualResetEvent, it's used to block thead(s) until some external event has been triggered. MSDN Doc:
http://msdn.microsoft.com/en-us/library/system.threading.manualresetevent.aspx
If you can use .NET 4.0 you can replace it with System.Threading.Semaphore which allows you to acquire permits in one thread and release them in another.
The Semaphore class does not enforce thread identity on calls to WaitOne or Release.
The primitive you're looking for is called a semaphore which can be safely entered on one thread and exited from another.