File Index Symbol Index

/******************************************************************************** * * * synchapi.h -- ApiSet Contract for api-ms-win-core-synch-l1 * * * * Copyright (c) Microsoft Corporation. All rights reserved. * * * ********************************************************************************/
#ifdef _MSC_VER
#pragma once
#endif // _MSC_VER
#ifndef _SYNCHAPI_H_
#define _SYNCHAPI_H_
#include <apiset.h>
#include <apisetcconv.h>
#include <minwindef.h>
#include <minwinbase.h>
#ifdef __cplusplus
extern
"C"
{
#endif
#pragma region Application or OneCore Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM)
//
// Define the slim R/W lock.
//
#define SRWLOCK_INIT RTL_SRWLOCK_INIT
typedef
RTL_SRWLOCK
SRWLOCK
, *
PSRWLOCK
;
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM) */
#pragma endregion #pragma region Application or OneCore Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM)
#if (_WIN32_WINNT >= 0x0600)
InitializeSRWLock
( );
_Releases_exclusive_lock_(*SRWLock)
ReleaseSRWLockExclusive
( );
_Releases_shared_lock_(*SRWLock)
ReleaseSRWLockShared
( );
_Acquires_exclusive_lock_(*SRWLock)
AcquireSRWLockExclusive
( );
_Acquires_shared_lock_(*SRWLock)
AcquireSRWLockShared
( );
_When_(return!=0, _Acquires_exclusive_lock_(*SRWLock))
BOOLEAN
TryAcquireSRWLockExclusive
( );
_When_(return!=0, _Acquires_shared_lock_(*SRWLock))
BOOLEAN
TryAcquireSRWLockShared
( );
#endif // (_WIN32_WINNT >= 0x0600)
#if (_WIN32_WINNT < 0x0600)
_Maybe_raises_SEH_exception_
WINBASEAPI
VOID
WINAPI
InitializeCriticalSection(
_Out_ LPCRITICAL_SECTION lpCriticalSection
);
#else
InitializeCriticalSection
( );
#endif // (_WIN32_WINNT < 0x0600)
EnterCriticalSection
( );
LeaveCriticalSection
( );
_Must_inspect_result_
BOOL
InitializeCriticalSectionAndSpinCount
( );
#if (_WIN32_WINNT >= 0x0600)
BOOL
InitializeCriticalSectionEx
( );
#endif // (_WIN32_WINNT >= 0x0600)
DWORD
SetCriticalSectionSpinCount
( );
#if (_WIN32_WINNT >= 0x0400)
BOOL
TryEnterCriticalSection
( );
#endif /* _WIN32_WINNT >= 0x0400 */
DeleteCriticalSection
( );
//
// Define one-time initialization primitive
//
typedef
RTL_RUN_ONCE
INIT_ONCE
;
typedef
PRTL_RUN_ONCE
PINIT_ONCE
;
typedef
PRTL_RUN_ONCE
LPINIT_ONCE
;
#define INIT_ONCE_STATIC_INIT RTL_RUN_ONCE_INIT
//
// Run once flags
//
#define INIT_ONCE_CHECK_ONLY RTL_RUN_ONCE_CHECK_ONLY
#define INIT_ONCE_ASYNC RTL_RUN_ONCE_ASYNC
#define INIT_ONCE_INIT_FAILED RTL_RUN_ONCE_INIT_FAILED
//
// The context stored in the run once structure must leave the following number
// of low order bits unused.
//
#define INIT_ONCE_CTX_RESERVED_BITS RTL_RUN_ONCE_CTX_RESERVED_BITS
typedef
BOOL
);
#if (_WIN32_WINNT >= 0x0600)
InitOnceInitialize
( );
BOOL
InitOnceExecuteOnce
( );
BOOL
InitOnceBeginInitialize
( );
BOOL
InitOnceComplete
( );
#endif // (_WIN32_WINNT >= 0x0600)
//
// Define condition variable
//
typedef
RTL_CONDITION_VARIABLE
CONDITION_VARIABLE
, *
PCONDITION_VARIABLE
;
//
// Static initializer for the condition variable
//
#define CONDITION_VARIABLE_INIT RTL_CONDITION_VARIABLE_INIT
//
// Flags for condition variables
//
#define CONDITION_VARIABLE_LOCKMODE_SHARED RTL_CONDITION_VARIABLE_LOCKMODE_SHARED
#if (_WIN32_WINNT >= 0x0600)
InitializeConditionVariable
( );
WakeConditionVariable
( );
WakeAllConditionVariable
( );
BOOL
SleepConditionVariableCS
( );
BOOL
SleepConditionVariableSRW
( );
#endif // (_WIN32_WINNT >= 0x0600)
BOOL
SetEvent
( );
BOOL
ResetEvent
( );
BOOL
ReleaseSemaphore
( );
BOOL
ReleaseMutex
( );
DWORD
WaitForSingleObject
( );
DWORD
SleepEx
( );
DWORD
WaitForSingleObjectEx
( );
DWORD
WaitForMultipleObjectsEx
( );
//
// Synchronization APIs
//
#define MUTEX_MODIFY_STATE MUTANT_QUERY_STATE
#define MUTEX_ALL_ACCESS MUTANT_ALL_ACCESS
_Ret_maybenull_
HANDLE
CreateMutexA
( );
_Ret_maybenull_
HANDLE
CreateMutexW
( );
#ifdef UNICODE
#define CreateMutex CreateMutexW
#else
#define CreateMutex CreateMutexA #endif // !UNICODE
_Ret_maybenull_
HANDLE
OpenMutexW
( );
#ifdef UNICODE
#define OpenMutex OpenMutexW #endif
_Ret_maybenull_
HANDLE
CreateEventA
( );
_Ret_maybenull_
HANDLE
CreateEventW
( );
#ifdef UNICODE
#define CreateEvent CreateEventW
#else
#define CreateEvent CreateEventA #endif // !UNICODE
_Ret_maybenull_
HANDLE
OpenEventA
( );
_Ret_maybenull_
HANDLE
OpenEventW
( );
#ifdef UNICODE
#define OpenEvent OpenEventW
#else
#define OpenEvent OpenEventA #endif // !UNICODE
_Ret_maybenull_
HANDLE
OpenSemaphoreW
( );
#ifdef UNICODE
#define OpenSemaphore OpenSemaphoreW #endif
#if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)
typedef
);
_Ret_maybenull_
HANDLE
OpenWaitableTimerW
( );
#ifdef UNICODE
#define OpenWaitableTimer OpenWaitableTimerW #endif
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN7)
BOOL
SetWaitableTimerEx
( );
#endif // (_WIN32_WINNT >= _WIN32_WINNT_WIN7)
BOOL
SetWaitableTimer
( );
BOOL
CancelWaitableTimer
( );
#if (_WIN32_WINNT >= 0x0600)
#define CREATE_MUTEX_INITIAL_OWNER 0x00000001
_Ret_maybenull_
HANDLE
CreateMutexExA
( );
_Ret_maybenull_
HANDLE
CreateMutexExW
( );
#ifdef UNICODE
#define CreateMutexEx CreateMutexExW
#else
#define CreateMutexEx CreateMutexExA #endif // !UNICODE
#define CREATE_EVENT_MANUAL_RESET 0x00000001
#define CREATE_EVENT_INITIAL_SET 0x00000002
_Ret_maybenull_
HANDLE
CreateEventExA
( );
_Ret_maybenull_
HANDLE
CreateEventExW
( );
#ifdef UNICODE
#define CreateEventEx CreateEventExW
#else
#define CreateEventEx CreateEventExA #endif // !UNICODE
_Ret_maybenull_
HANDLE
CreateSemaphoreExW
( );
#ifdef UNICODE
#define CreateSemaphoreEx CreateSemaphoreExW #endif
#define CREATE_WAITABLE_TIMER_MANUAL_RESET 0x00000001
#if (_WIN32_WINNT >= _NT_TARGET_VERSION_WIN10_RS4)
#define CREATE_WAITABLE_TIMER_HIGH_RESOLUTION 0x00000002 #endif
_Ret_maybenull_
HANDLE
CreateWaitableTimerExW
( );
#ifdef UNICODE
#define CreateWaitableTimerEx CreateWaitableTimerExW #endif
#endif // (_WIN32_WINNT >= 0x0600)
#endif // (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM) */
#pragma endregion #pragma region Desktop or OneCore Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM)
typedef
RTL_BARRIER
SYNCHRONIZATION_BARRIER
;
typedef
PRTL_BARRIER
PSYNCHRONIZATION_BARRIER
;
typedef
PRTL_BARRIER
LPSYNCHRONIZATION_BARRIER
;
#define SYNCHRONIZATION_BARRIER_FLAGS_SPIN_ONLY 0x01
#define SYNCHRONIZATION_BARRIER_FLAGS_BLOCK_ONLY 0x02
#define SYNCHRONIZATION_BARRIER_FLAGS_NO_DELETE 0x04
BOOL
EnterSynchronizationBarrier
( );
BOOL
InitializeSynchronizationBarrier
( );
BOOL
DeleteSynchronizationBarrier
( );
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM) */
#pragma endregion #pragma region Application or OneCore Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM)
Sleep
( );
BOOL
WaitOnAddress
( );
WakeByAddressSingle
( );
WakeByAddressAll
( );
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM) */
#pragma endregion #pragma region Desktop or OneCore Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM)
#ifndef MIDL_PASS
DWORD
SignalObjectAndWait
( );
#endif
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM) */
#pragma endregion #pragma region Application or OneCore Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM)
DWORD
WaitForMultipleObjects
( );
HANDLE
CreateSemaphoreW
( );
#ifdef UNICODE
#define CreateSemaphore CreateSemaphoreW #endif
_Ret_maybenull_
HANDLE
CreateWaitableTimerW
( );
#ifdef UNICODE
#define CreateWaitableTimer CreateWaitableTimerW #endif
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM) */
#pragma endregion
#ifdef __cplusplus
}
#endif
#endif // _SYNCHAPI_H_