在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
lock关键字,
Monitor监控器, using System.Threading; // 提供同步访问对象的机制。 public static class Monitor { public static bool Wait(object obj, xxx); public static void Enter(object obj, xxx); public static bool TryEnter(object obj, xxx); public static void Exit(object obj); public static void Pulse(object obj); public static void PulseAll(object obj); }
参考:
Semaphore信号量, using System.Threading; // 限制可同时访问某一资源或资源池的线程数 public sealed class Semaphore : WaitHandle { public Semaphore(int initialCount, int maximumCount, xxx); public static Semaphore OpenExisting(string name, xxx); public int Release(); public int Release(int releaseCount); }
Mutex互斥体, using System.Threading; // 一个同步基元,也可用于进程间同步。 public sealed class Mutex : WaitHandle { public Mutex(); public Mutex(bool initiallyOwned, xxx); public static Mutex OpenExisting(string name); public void ReleaseMutex(); }
参考:
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论