网站首页  词典首页

请输入您要查询的函数:

 

术语 sleepconditionvariablecs
释义 SleepConditionVariableCS
语法:
C++
BOOL WINAPI SleepConditionVariableCS(
__inout PCONDITION_VARIABLE ConditionVariable,
__inout PCRITICAL_SECTION CriticalSection,
__in DWORD dwMilliseconds
);
SleepConditionVariableCS功能
睡在指定的条件变量,并释放一个原子操作指定的关键部分。
参数
ConditionVariable [ in , out ]
一个条件变量的指针。这个变量必须初始化使用InitializeConditionVariable功能。
CriticalSection [ in , out ]
一个临界区对象的指针。
dwMilliseconds的 [in]
在超时间隔时间,以毫秒为单位。如果超时间隔经过的,,功能重新获得该临界区和返回零。如果dwMilliseconds的是零,功能检查指定的对象和国家立即返回。如果dwMilliseconds的是无限的,该函数的超时时间间隔从未经过的。有关更多信息,请参见备注。
返回值
如果函数成功,返回值为非零。
如果函数失败或超时间隔经过的,,返回值是零。为了获得更多错误信息,调用GetLastError。可能的错误代码包括WAIT_TIMEOUT,这表明,超时时间间隔过去了另一个线程在试图唤醒沉睡的线程。
备注
线程是在一个条件变量可以被唤醒沉睡在指定超时时间间隔已过使用WakeConditionVariable或WakeAllConditionVariable功能。在这种情况下,线程被唤醒时,后处理完成,而不是当它超时间隔经过的。当线程被唤醒,它重新获得它的临界区时释放线程进入睡眠状态。
条件变量受(不明确之后,相关的人),假被盗唤醒唤醒(另一个线程之前运行管理的唤醒线程)。因此,您应该重新检查后的谓词睡眠操作返回(通常在while循环)。
实例
举例说,使用此功能,请参阅使用条件变量。
要求:
client最低支持Vista
server最低支持 Windows Server 2008
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
参见
条件变量
同步功能
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==SleepConditionVariableCS Function
Sleeps on the specified condition variable and releases the specified critical section as an atomic operation.
Syntax
C++
BOOL WINAPI SleepConditionVariableCS(
__inout PCONDITION_VARIABLE ConditionVariable,
__inout PCRITICAL_SECTION CriticalSection,
__in DWORD dwMilliseconds
);
Parameters
ConditionVariable [in, out]
A pointer to the condition variable. This variable must be initialized using the InitializeConditionVariable function.
CriticalSection [in, out]
A pointer to the critical section object.
dwMilliseconds [in]
The time-out interval, in milliseconds. If the time-out interval elapses, the function re-acquires the critical section and returns zero. If dwMilliseconds is zero, the function tests the states of the specified objects and returns immediately. If dwMilliseconds is INFINITE, the function's time-out interval never elapses. For more information, see Remarks.
Return Value
If the function succeeds, the return value is nonzero.
If the function fails or the time-out interval elapses, the return value is zero. To get extended error information, call GetLastError . Possible error codes include WAIT_TIMEOUT, which indicates that the time-out interval has elapsed before another thread has attempted to wake the sleeping thread.
Remarks
A thread that is sleeping on a condition variable can be woken before the specified time-out interval has elapsed using the WakeConditionVariable or WakeAllConditionVariable function. In this case, the thread wakes when the wake processing is complete, and not when its time-out interval elapses. After the thread is woken, it re-acquires the critical section it released when the thread entered the sleeping state.
Condition variables are subject to spurious wakeups (those not associated with an explicit wake) and stolen wakeups (another thread manages to run before the woken thread). Therefore, you should recheck a predicate (typically in a while loop) after a sleep operation returns.
Examples
For an example that uses this function, see Using Condition Variables .
Requirements
Minimum supported clientWindows Vista
Minimum supported serverWindows Server 2008
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
See Also
Condition Variables
Synchronization Functions
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms686301(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:21:26