Unfortunately, there is no Semaphore in System.Threading when using the .NET Compact Framework. I'm not sure why that is, does anyone have an idea?
After googling I've found a bunch of people giving their own implementations, but none of them really worked great... or at all!
So I've come to ask the experts...
Does anyone have a good semaphore class/library they can recommend for the .NET compact framework?
OR
Is there someway I can emulate the behaviour?
I have a typical producer/consumer setup in which a thread pushes objects on to a Queue (System.Collections). I then want a consumer thread to pull objects off the queue and do work, but obviously only when there are things on the queue to work with!
I am working in C#, but I'll take solutions/pseudo in any language so long as I can implement it on .NET CF.
You can just PInvoke to CreateSemaphore and ReleaseSemaphore- they're implemented on CE in coredll. Pretty easy to write a nice managed wrapper that looks like System.Threading.Semaphore.
I think there is a semaphore implementation in OpenNETCF