网站首页  词典首页

请输入您要查询的函数:

 

术语 releasemutex
释义 ReleaseMutex
语法:
C++
BOOL WINAPI ReleaseMutex(
__in HANDLE hMutex
);
ReleaseMutex函数
发布指定互斥对象的所有权。
参数
hMutex [in]
一个句柄,互斥对象。在CreateMutex或OpenMutex函数返回此句柄。
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
备注
该ReleaseMutex函数失败如果调用线程不拥有互斥对象。
一个线程获得互斥锁的所有权或者通过建立与设置为TRUE bInitialOwner参数,或通过指定的呼叫处理的等待职能之一。当线程不再需要拥有互斥对象时,它调用ReleaseMutex函数,以便其他线程可以取得所有权。
线程可以指定一个互斥量,它已经在呼吁拥有的等待没有阻止其执行职能之一。这可以防止死锁本身而互斥体,它已经拥有等待一个线程。然而,释放其所有权,该线程必须要求每次ReleaseMutex有一次,它获得的所有权(或者通过CreateMutex或等待功能)。
实例
举一个例子,它使用ReleaseMutex,请参阅使用互斥对象。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
参见
CreateMutex
互斥对象
同步功能
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==ReleaseMutex Function
Releases ownership of the specified mutex object.
Syntax
C++
BOOL WINAPI ReleaseMutex(
__in HANDLE hMutex
);
Parameters
hMutex [in]
A handle to the mutex object. The CreateMutex or OpenMutex function returns this handle.
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError .
Remarks
The ReleaseMutex function fails if the calling thread does not own the mutex object.
A thread obtains ownership of a mutex either by creating it with the bInitialOwner parameter set to TRUE or by specifying its handle in a call to one of the wait functions . When the thread no longer needs to own the mutex object, it calls the ReleaseMutex function so that another thread can acquire ownership.
A thread can specify a mutex that it already owns in a call to one of the wait functions without blocking its execution. This prevents a thread from deadlocking itself while waiting for a mutex that it already owns. However, to release its ownership, the thread must call ReleaseMutex one time for each time that it obtained ownership (either through CreateMutex or a wait function).
Examples
For an example that uses ReleaseMutex, see Using Mutex Objects .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
See Also
CreateMutex
Mutex Objects
Synchronization Functions
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms685066(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:22:50