windows内核同步函数

本文详细介绍了Windows内核提供的同步函数,包括CreateEvent、CreateMutex等,并对每个函数的作用进行了说明。这些函数用于实现进程间的同步操作,是Windows编程中不可或缺的一部分。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

windows内核提供了一系列的同步函数:在msdn上的链接如下:

http://msdn.microsoft.com/zh-cn/library/aa909196.aspx

The following table shows the kernel synchronization functions.

Functions Description

CreateEvent

Creates a named or an unnamed event object.

CreateMutex

Creates a named or unnamed mutex object.

CreateSemaphore

Creates a named or unnamed semaphore object.

DeleteCriticalSection

Releases all resources used by a critical section object that is not owned.

DuplicateHandle

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

Waits for ownership of the specified critical section object.

InitializeCriticalSection

Initializes a critical section object.

InterlockedCompareExchange

Performs an atomic comparison of the specified values and exchanges the values based on the outcome of the comparison.

InterlockedCompareExchangePointer

Performs an atomic comparison of the specified parameter values and exchanges the values based on the outcome of the comparison.

InterlockedDecrement

Decrements the value of the specified 32-bit variable, and checks the resulting value.

InterlockedExchange

Exchanges a pair of 32-bit values.

InterlockedExchangeAdd

Increments an Addend variable.

InterlockedExchangePointer

Exchanges a pair of values.

InterlockedIncrement

Increments the value of the specified 32-bit variable, and checks the resulting value.

InterlockedTestExchange

Performs a conditional setting of a variable.

LeaveCriticalSection

Releases ownership of the specified critical section object.

OpenEvent

Opens an existing named event object.

PulseEvent

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

Releases ownership of the specified mutex object.

ReleaseSemaphore

Increases the count of the specified semaphore object by a specified amount.

ResetEvent

Sets the state of the specified event object to nonsignaled.

SetEvent

Sets the state of the specified event object to signaled.

TryEnterCriticalSection

Attempts to enter a critical section without blocking.

WaitForMultipleObjects

Returns when either any one of the specified objects is in the signaled state, or the time-out interval elapses.

WaitForSingleObject

Returns when the specified object is in the signaled state or when the time-out interval elapses.

 

转载于:https://my.oschina.net/u/1024767/blog/358010

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值