现在的位置: 首页 > 综合 > 正文

windows多线程同步参考

2013年10月13日 ⁄ 综合 ⁄ 共 2594字 ⁄ 字号 评论关闭

Synchronization Functions

The following table shows the kernel synchronization functions.

Programming element Description
CreateEvent This function creates a named or an unnamed event object.
CreateMutex This function creates a named or unnamed mutex object.
CreateSemaphore This function creates a named or unnamed semaphore object.
DeleteCriticalSection This function releases all resources used by a critical section object that is not owned.
DuplicateHandle This function duplicates an object handle. The duplicate handle refers to the same object as the original handle. Therefore, any changes to the object are reflected through both handles.
EnterCriticalSection This function waits for ownership of the specified critical section object.
InitializeCriticalSection This function initializes a critical section object.
InterlockedCompareExchange This function performs an atomic comparison of the specified values and exchanges the values based on the outcome of the comparison.
InterlockedCompareExchangePointer This function performs an atomic comparison of the specified parameter values and exchanges the values based on the outcome of the comparison.
InterlockedDecrement This function both decrements (decreases by one) the value of the specified 32-bit variable and checks the resulting value.
InterlockedExchange This function atomically exchanges a pair of 32-bit values.
InterlockedExchangeAdd This function performs an atomic addition of an increment value to an Addend variable.
InterlockedExchangePointer This function atomically exchanges a pair of values.
InterlockedIncrement This function both increments (increases by one) the value of the specified 32-bit variable and checks the resulting value.
InterlockedTestExchange This function is an interlocked function that performs a conditional setting of a variable.
LeaveCriticalSection This function releases ownership of the specified critical section object.
OpenEvent This function opens an existing named event object.
PulseEvent This function provides a single operation that sets to signaled the state of the specified event object and then resets it to nonsignaled after releasing the appropriate number of waiting threads.
ReleaseMutex This function releases ownership of the specified mutex object.
ReleaseSemaphore This function increases the count of the specified semaphore object by a specified amount.
ResetEvent This function sets the state of the specified event object to nonsignaled.
SetEvent This function sets the state of the specified event object to signaled.
TryEnterCriticalSection This function attempts to enter a critical section without blocking.
WaitForMultipleObjects This function returns when either any one of the specified objects is in the signaled state, or the time-out interval elapses.
WaitForSingleObject This function returns when the specified object is in the signaled state or when the time-out interval elapses.

See Also

Synchronization Reference

抱歉!评论已关闭.