一键重装系统工具 | U盘启动盘制作工具 | 误删文件恢复软件 | 硬盘数据抢救专家 | 电脑蓝屏修复助手 | C盘空间清理神器 | 电脑驱动离线安装工具 | 微信聊天记录恢复工具 | 照片误格式化恢复 | 电脑密码破解清除工具 | 系统崩溃紧急救援盘 | 电脑加速优化大师 | 电脑开不了机怎么重装系统 | 回收站清空了怎么恢复 | 硬盘分区丢失数据恢复 | 电脑卡顿重装系统有用吗 | U盘插入提示格式化数据恢复 | 电脑中毒文件被隐藏恢复 | 忘记电脑开机密码怎么办 | 新硬盘分区对齐工具 | 旧电脑装Win10流畅工具 | SD卡照片删除恢复免费版 | 移动硬盘打不开提示损坏修复 | 电脑无故重启系统修复工具 | 电脑小白一键重装神器 | 程序员电脑环境配置助手 | 设计师电脑字体/素材恢复工具 | 网吧网管系统维护工具箱 | 财务人员电脑发票备份恢复 | 学生党免费电脑系统安装包 | 电脑维修师傅必备工具盘 | 游戏玩家电脑性能优化助手 | 办公白领误删文档恢复软件 | 自媒体视频素材恢复工具 | 网课录制视频损坏修复工具 | 最好的U盘PE系统排名 | 数据恢复软件哪个最强 | 免费电脑助手与收费版区别 | 国产装机工具哪款无广告 | 离线版驱动助手推荐 | 轻量级电脑优化工具对比 | 支持NVMe驱动的PE工具 | 带网络功能的应急启动盘 | 2026最新版万能装机工具 | 支持Win11 24H2的PE工具 | 最新免激活系统重装工具 | 2026数据恢复软件破解版合集 | 纯净无捆绑装机助手V3.0 | 支持苹果M芯片的电脑助手 | 秋季更新版系统维护工具箱 | 电脑系统崩了怎么用U盘把重要资料拷贝出来 | 重装系统前哪些文件夹必须备份 | 固态硬盘误格式化还能恢复数据吗 | 如何制作一个既带PE又能存数据的双分区U盘 | 电脑总是弹窗广告用什么助手彻底拦截 后台管理
📢 欢迎访问系统之家!所有资源均经过安全检测。

WaitHandle Class (System.Threading)

发布时间:2026-09-10 | 浏览:1
📥 下载地址(文章开头)
装机神器,一键装机,安装任何系统。纯净版,原版,软件版,精简版,英文版。
Access to this page requires authorization. You can try signing in or changing directories . Access to this page requires authorization. You can try changing directories . Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here. Encapsulates operating system-specific objects that wait for exclusive access to shared resources. The following code example shows how two threads can do background tasks while the Main thread waits for the tasks to complete using the static WaitAny and WaitAll methods of the WaitHandle class. The WaitHandle class encapsulates a native operating system synchronization handle and is used to represent all synchronization objects in the runtime that allow multiple wait operations. For a comparison of wait handles with other synchronization objects, see Overview of Synchronization Primitives . The WaitHandle class itself is abstract. Classes derived from WaitHandle define a signaling mechanism to indicate taking or releasing access to a shared resource, but they use the inherited WaitHandle methods to block while waiting for access to shared resources. The classes derived from WaitHandle include: The Mutex class. See Mutexes . The Mutex class. See Mutexes . The EventWaitHandle class and its derived classes, AutoResetEvent and ManualResetEvent . The EventWaitHandle class and its derived classes, AutoResetEvent and ManualResetEvent . The Semaphore class. See Semaphore and SemaphoreSlim . The Semaphore class. See Semaphore and SemaphoreSlim . Threads can block on an individual wait handle by calling the instance method WaitOne , which is inherited by classes derived from WaitHandle . The derived classes of WaitHandle differ in their thread affinity. Event wait handles ( EventWaitHandle , AutoResetEvent , and ManualResetEvent ) and semaphores do not have thread affinity; any thread can signal an event wait handle or semaphore. Mutexes, on the other hand, do have thread affinity; the thread that owns a mutex must release it, and an exception is thrown if a thread calls the ReleaseMutex method on a mutex that it does not own. Because the WaitHandle class derives from MarshalByRefObject , these classes can be used to synchronize the activities of threads across application domain boundaries. In addition to its derived classes, the WaitHandle class has a number of static methods that block a thread until one or more synchronization objects receive a signal. These include: SignalAndWait , which allows a thread to signal one wait handle and immediately wait on another. SignalAndWait , which allows a thread to signal one wait handle and immediately wait on another. WaitAll , which allows a thread to wait until all the wait handles in an array receive a signal. WaitAll , which allows a thread to wait until all the wait handles in an array receive a signal. WaitAny , which allows a thread to wait until any one of a specified set of wait handles has been signaled. WaitAny , which allows a thread to wait until any one of a specified set of wait handles has been signaled. The overloads of these methods provide timeout intervals for abandoning the wait, and the opportunity to exit a synchronization context before entering the wait, allowing other threads to use the synchronization context. This type implements the IDisposable interface. When you've finished using the type or a type derived from it, you should dispose of it either directly or indirectly. To dispose of the type directly, call its Close method in a try / finally block. To dispose of it indirectly, use a language construct such as using in C#. When you derive from WaitHandle , use the SafeWaitHandle property to store your native operating system handle. You do not need to override the protected Dispose method unless you use additional unmanaged resources. Initializes a new instance of the WaitHandle class. Represents an invalid native operating system handle. This field is read-only. Indicates that a WaitAny(WaitHandle[], Int32, Boolean) operation timed out before any of the wait handles were signaled. This field is constant. Gets or sets the native operating system handle. Gets or sets the native operating system handle. Releases all resources held by the current WaitHandle . Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. Releases all resources used by the current instance of the WaitHandle class. When overridden in a derived class, releases the unmanaged resources used by the WaitHandle , and optionally releases the managed resources. Determines whether the specified object is equal to the current object. Releases the resources held by the current instance.
📥 下载地址(文章中间)
装机神器,一键装机,安装任何系统。纯净版,原版,软件版,精简版,英文版。
Serves as the default hash function. Retrieves the current lifetime service object that controls the lifetime policy for this instance. Gets the Type of the current instance. Obtains a lifetime service object to control the lifetime policy for this instance. Creates a shallow copy of the current Object . Creates a shallow copy of the current MarshalByRefObject object. Signals one WaitHandle and waits on another, specifying a time-out interval as a 32-bit signed integer and specifying whether to exit the synchronization domain for the context before entering the wait. Signals one WaitHandle and waits on another, specifying the time-out interval as a TimeSpan and specifying whether to exit the synchronization domain for the context before entering the wait. Signals one WaitHandle and waits on another. Returns a string that represents the current object. Waits for all the elements in the specified array to receive a signal, using an Int32 value to specify the time interval and specifying whether to exit the synchronization domain before the wait. Waits for all the elements in the specified array to receive a signal, using an Int32 value to specify the time interval. Waits for all the elements in the specified array to receive a signal, using a TimeSpan value to specify the time interval, and specifying whether to exit the synchronization domain before the wait. Waits for all the elements in the specified array to receive a signal, using a TimeSpan value to specify the time interval. Waits for all the elements in the specified array to receive a signal. Waits for any of the elements in the specified array to receive a signal, using a 32-bit signed integer to specify the time interval, and specifying whether to exit the synchronization domain before the wait. Waits for any of the elements in the specified array to receive a signal, using a 32-bit signed integer to specify the time interval. Waits for any of the elements in the specified array to receive a signal, using a TimeSpan to specify the time interval and specifying whether to exit the synchronization domain before the wait. Waits for any of the elements in the specified array to receive a signal, using a TimeSpan to specify the time interval. Waits for any of the elements in the specified array to receive a signal. Blocks the current thread until the current WaitHandle receives a signal. Blocks the current thread until the current WaitHandle receives a signal, using a 32-bit signed integer to specify the time interval and specifying whether to exit the synchronization domain before the wait. Blocks the current thread until the current WaitHandle receives a signal, using a 32-bit signed integer to specify the time interval in milliseconds. Blocks the current thread until the current instance receives a signal, using a TimeSpan to specify the time interval and specifying whether to exit the synchronization domain before the wait. Blocks the current thread until the current instance receives a signal, using a TimeSpan to specify the time interval. Explicit Interface Implementations This API supports the product infrastructure and is not intended to be used directly from your code. Releases all resources used by the WaitHandle . Extension Methods Gets the safe handle for a native operating system wait handle. Sets a safe handle for a native operating system wait handle. This type is thread safe. Threading Objects and Features EventWaitHandle, AutoResetEvent, and ManualResetEvent Was this page helpful? Need help with this topic? Want to try using Ask Learn to clarify or guide you through this topic?
📥 下载地址(文章结尾)
装机神器,一键装机,安装任何系统。纯净版,原版,软件版,精简版,英文版。