What is the correspondence .Net Class?
-
I want to program a app that use Producer-Consumer Multithread model, I used to use WinAPI WaitForSingleObject & ReleaseSemaphore as a PV operator. Which .Net class can I use to implement to same ? Thank you! Let's roll!
-
I want to program a app that use Producer-Consumer Multithread model, I used to use WinAPI WaitForSingleObject & ReleaseSemaphore as a PV operator. Which .Net class can I use to implement to same ? Thank you! Let's roll!
See the class documentation for the
System.Threading
namespace in the .NET Framework SDK. There's lots of information in there.WaitHandle
and its derivates have several wait methods that wait for theWaitHandle
to be signaled. There's also classes for mutexes and monitors. If you use thelock
keyword in C# against an instance of an object (a static object for synchronizing static resources, and an instance - if you prefer - for instance resources). There's a good section on programming in .NET with threads. See Threading[^] in the .NET Framework SDK on MSDN Online for more information, which should be the first place you check (such as scanning what's available in the class library reference).Microsoft MVP, Visual C# My Articles