您的位置:首页 > 移动开发 > Objective-C

Windows API 之 CreateThread、WaitForSingleObject(未完)

2015-10-23 18:02 465 查看

WaitForSingleObject

Waits until the specified object is in the signaled state or the time-out interval elapses.

DWORD WINAPI WaitForSingleObject(
_In_ HANDLE hHandle,
_In_ DWORD  dwMilliseconds
);


Remarks

The WaitForSingleObject function checks the current state of the specified object. If the object's state is nonsignaled, the calling thread enters the wait state until the object is signaled or the time-out interval elapses.

The function modifies the state of some types of synchronization objects. Modification occurs only for the object whose signaled state caused the function to return. For example, the count of a semaphore object is decreased by one.

The WaitForSingleObject function can wait for the following objects:

Change notification

Console input

Event

Memory resource notification

Mutex

Process

Semaphore

Thread

Waitable timer

CreateThread

Creates a thread to execute within the virtual address space of the calling process.

HANDLE WINAPI CreateThread(
_In_opt_  LPSECURITY_ATTRIBUTES  lpThreadAttributes,
_In_      SIZE_T                 dwStackSize,
_In_      LPTHREAD_START_ROUTINE lpStartAddress,
_In_opt_  LPVOID                 lpParameter,
_In_      DWORD                  dwCreationFlags,
_Out_opt_ LPDWORD                lpThreadId
);


参考:

MSDN:https://msdn.microsoft.com/en-us/library/ms687032.aspx

https://msdn.microsoft.com/en-us/library/windows/desktop/ms682453%28v=vs.85%29.aspx
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: