windows多线程同步参考

Synchronization Functions

The following table shows the kernel synchronization functions.

Programming elementDescription
CreateEventThis function creates a named or an unnamed event object.
CreateMutexThis function creates a named or unnamed mutex object.
CreateSemaphoreThis function creates a named or unnamed semaphore object.
DeleteCriticalSectionThis function releases all resources used by a critical section object that is not owned.
DuplicateHandleThis 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.
EnterCriticalSectionThis function waits for ownership of the specified critical section object.
InitializeCriticalSectionThis function initializes a critical section object.
InterlockedCompareExchangeThis function performs an atomic comparison of the specified values and exchanges the values based on the outcome of the comparison.
InterlockedCompareExchangePointerThis function performs an atomic comparison of the specified parameter values and exchanges the values based on the outcome of the comparison.
InterlockedDecrementThis function both decrements (decreases by one) the value of the specified 32-bit variable and checks the resulting value.
InterlockedExchangeThis function atomically exchanges a pair of 32-bit values.
InterlockedExchangeAddThis function performs an atomic addition of an increment value to an Addend variable.
InterlockedExchangePointerThis function atomically exchanges a pair of values.
InterlockedIncrementThis function both increments (increases by one) the value of the specified 32-bit variable and checks the resulting value.
InterlockedTestExchangeThis function is an interlocked function that performs a conditional setting of a variable.
LeaveCriticalSectionThis function releases ownership of the specified critical section object.
OpenEventThis function opens an existing named event object.
PulseEventThis 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.
ReleaseMutexThis function releases ownership of the specified mutex object.
ReleaseSemaphoreThis function increases the count of the specified semaphore object by a specified amount.
ResetEventThis function sets the state of the specified event object to nonsignaled.
SetEventThis function sets the state of the specified event object to signaled.
TryEnterCriticalSectionThis function attempts to enter a critical section without blocking.
WaitForMultipleObjectsThis function returns when either any one of the specified objects is in the signaled state, or the time-out interval elapses.
WaitForSingleObjectThis function returns when the specified object is in the signaled state or when the time-out interval elapses.
See Also

Synchronization Reference

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值