Wait until either the specified object is in the signaled state, or until the time-out interval elapses.
DWORD RtWaitForSingleObject(
HANDLE hHandle,
DWORD dwMilliseconds
);
Parameters
hHandle
- Handle to the object. For a list of object types whose handles can be specified, see the Remarks section.
dwMilliseconds
- Specifies the time-out interval, in milliseconds. If the interval elapses, the function returns, even if the object's state is nonsignaled. If
dwMilliseconds
is zero, the function tests the object's state and returns immediately. If dwMilliseconds
is INFINITE, the function's time-out interval never elapses.
Remarks
The handle can refer to an object of the following type:
- Event: Wait until the event is signalled.
- Mutex: Wait until the mutex is not owned or recursively own the same mutex. When the mutex is owned and the current thread has a better priority than the owning thread, the priority of the owning thread is temporarily made equal to that of the current thread, until the owning thread releases the last mutex it owns.
- Semaphore: Wait until a unit is available.
- Process: Wait until the process has terminated.
- Thread: Wait until the thread has terminated.
You can also use the RtWaitForSingleObject function from a Windows application to wait for an iwin32 object. In that environment, when a mutex causes a change in a thread's priority, the thread is part of the iwin32x proxy; it is NOT the Windows thread!
Return Values
WAIT_OBJECT_0 |
Success. The specified object's state is signaled. |
WAIT_ABANDONED_0 |
Success. The specified object was deleted while waiting. |
WAIT_TIMEOUT |
Success. The time-out interval elapsed, and the object's state is nonsignaled. |
WAIT_FAILED |
Failure. Waiting on an invalid handle causes this function to return WAIT_FAILED. |
For extended error information, see the Windows' GetLastError function.
Remarks
- RtWaitForSingleObject is used from a Windows application to wait for an iwin32 object; in that environment when a mutex causes a change in a thread's priority, the thread is part of the iwin32x proxy; it is NOT the Windows thread!
- The handle can refer to an object of the following type:
- Event: Wait until the event is signalled.
- Mutex: Wait until the mutex is not owned or recursively own the same mutex. When the mutex is owned and the current thread has a better priority than the owning thread, the priority of the owning thread is temporarily made equal to that of the current thread, until the owning thread releases the last mutex it owns.
- Semaphore: Wait until a unit is available.
- Process: Wait until the process has terminated.
- Thread: Wait until the thread has terminated.
Requirements
Versions |
Defined in |
Include |
Link to |
INtime 3.0 |
iwin32x.h |
iwin32x.h |
iwin32x.lib |
Notes
- This function operates in the Windows portion of your application.
- The iwin32 API also includes an RtWaitForSingleObject function that operates in the real-time portion of your application.
See Also
iwin32x API, iwin32 Overview