[1166] | 1 | /**
|
---|
| 2 | * This file is part of the mingw-w64 runtime package.
|
---|
| 3 | * No warranty is given; refer to the file DISCLAIMER within this package.
|
---|
| 4 | */
|
---|
| 5 | #ifndef _SYNCHAPI_H_
|
---|
| 6 | #define _SYNCHAPI_H_
|
---|
| 7 |
|
---|
| 8 | #include <apiset.h>
|
---|
| 9 | #include <apisetcconv.h>
|
---|
| 10 | #include <minwindef.h>
|
---|
| 11 | #include <minwinbase.h>
|
---|
| 12 |
|
---|
| 13 | #ifdef __cplusplus
|
---|
| 14 | extern "C" {
|
---|
| 15 | #endif
|
---|
| 16 |
|
---|
| 17 | #define SRWLOCK_INIT RTL_SRWLOCK_INIT
|
---|
| 18 |
|
---|
| 19 | #define INIT_ONCE_STATIC_INIT RTL_RUN_ONCE_INIT
|
---|
| 20 |
|
---|
| 21 | #define INIT_ONCE_CHECK_ONLY RTL_RUN_ONCE_CHECK_ONLY
|
---|
| 22 | #define INIT_ONCE_ASYNC RTL_RUN_ONCE_ASYNC
|
---|
| 23 | #define INIT_ONCE_INIT_FAILED RTL_RUN_ONCE_INIT_FAILED
|
---|
| 24 |
|
---|
| 25 | #define INIT_ONCE_CTX_RESERVED_BITS RTL_RUN_ONCE_CTX_RESERVED_BITS
|
---|
| 26 |
|
---|
| 27 | #define CONDITION_VARIABLE_INIT RTL_CONDITION_VARIABLE_INIT
|
---|
| 28 |
|
---|
| 29 | #define CONDITION_VARIABLE_LOCKMODE_SHARED RTL_CONDITION_VARIABLE_LOCKMODE_SHARED
|
---|
| 30 |
|
---|
| 31 | #define MUTEX_MODIFY_STATE MUTANT_QUERY_STATE
|
---|
| 32 | #define MUTEX_ALL_ACCESS MUTANT_ALL_ACCESS
|
---|
| 33 |
|
---|
| 34 | typedef RTL_SRWLOCK SRWLOCK, *PSRWLOCK;
|
---|
| 35 |
|
---|
| 36 | typedef RTL_RUN_ONCE INIT_ONCE;
|
---|
| 37 | typedef PRTL_RUN_ONCE PINIT_ONCE;
|
---|
| 38 | typedef PRTL_RUN_ONCE LPINIT_ONCE;
|
---|
| 39 |
|
---|
| 40 | typedef WINBOOL (WINAPI *PINIT_ONCE_FN) (PINIT_ONCE InitOnce, PVOID Parameter, PVOID *Context);
|
---|
| 41 | typedef RTL_CONDITION_VARIABLE CONDITION_VARIABLE, *PCONDITION_VARIABLE;
|
---|
| 42 |
|
---|
| 43 | WINBASEAPI VOID WINAPI EnterCriticalSection (LPCRITICAL_SECTION lpCriticalSection);
|
---|
| 44 | WINBASEAPI VOID WINAPI LeaveCriticalSection (LPCRITICAL_SECTION lpCriticalSection);
|
---|
| 45 | WINBASEAPI WINBOOL WINAPI TryEnterCriticalSection (LPCRITICAL_SECTION lpCriticalSection);
|
---|
| 46 | WINBASEAPI VOID WINAPI DeleteCriticalSection (LPCRITICAL_SECTION lpCriticalSection);
|
---|
| 47 | WINBASEAPI WINBOOL WINAPI SetEvent (HANDLE hEvent);
|
---|
| 48 | WINBASEAPI WINBOOL WINAPI ResetEvent (HANDLE hEvent);
|
---|
| 49 | WINBASEAPI WINBOOL WINAPI ReleaseSemaphore (HANDLE hSemaphore, LONG lReleaseCount, LPLONG lpPreviousCount);
|
---|
| 50 | WINBASEAPI WINBOOL WINAPI ReleaseMutex (HANDLE hMutex);
|
---|
| 51 | WINBASEAPI DWORD WINAPI WaitForSingleObjectEx (HANDLE hHandle, DWORD dwMilliseconds, WINBOOL bAlertable);
|
---|
| 52 | WINBASEAPI DWORD WINAPI WaitForMultipleObjectsEx (DWORD nCount, CONST HANDLE *lpHandles, WINBOOL bWaitAll, DWORD dwMilliseconds, WINBOOL bAlertable);
|
---|
| 53 | WINBASEAPI HANDLE WINAPI OpenMutexW (DWORD dwDesiredAccess, WINBOOL bInheritHandle, LPCWSTR lpName);
|
---|
| 54 | WINBASEAPI HANDLE WINAPI OpenEventA (DWORD dwDesiredAccess, WINBOOL bInheritHandle, LPCSTR lpName);
|
---|
| 55 | WINBASEAPI HANDLE WINAPI OpenEventW (DWORD dwDesiredAccess, WINBOOL bInheritHandle, LPCWSTR lpName);
|
---|
| 56 | WINBASEAPI HANDLE WINAPI OpenSemaphoreW (DWORD dwDesiredAccess, WINBOOL bInheritHandle, LPCWSTR lpName);
|
---|
| 57 | WINBOOL WINAPI WaitOnAddress (volatile VOID *Address, PVOID CompareAddress, SIZE_T AddressSize, DWORD dwMilliseconds);
|
---|
| 58 | VOID WINAPI WakeByAddressSingle (PVOID Address);
|
---|
| 59 | VOID WINAPI WakeByAddressAll (PVOID Address);
|
---|
| 60 | #if _WIN32_WINNT >= 0x0600
|
---|
| 61 | #define CREATE_MUTEX_INITIAL_OWNER 0x1
|
---|
| 62 |
|
---|
| 63 | #define CREATE_EVENT_MANUAL_RESET 0x1
|
---|
| 64 | #define CREATE_EVENT_INITIAL_SET 0x2
|
---|
| 65 |
|
---|
| 66 | WINBASEAPI VOID WINAPI InitializeSRWLock (PSRWLOCK SRWLock);
|
---|
| 67 | VOID WINAPI ReleaseSRWLockExclusive (PSRWLOCK SRWLock);
|
---|
| 68 | VOID WINAPI ReleaseSRWLockShared (PSRWLOCK SRWLock);
|
---|
| 69 | VOID WINAPI AcquireSRWLockExclusive (PSRWLOCK SRWLock);
|
---|
| 70 | VOID WINAPI AcquireSRWLockShared (PSRWLOCK SRWLock);
|
---|
| 71 | WINBASEAPI BOOLEAN WINAPI TryAcquireSRWLockExclusive (PSRWLOCK SRWLock);
|
---|
| 72 | WINBASEAPI BOOLEAN WINAPI TryAcquireSRWLockShared (PSRWLOCK SRWLock);
|
---|
| 73 | WINBASEAPI WINBOOL WINAPI InitializeCriticalSectionEx (LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount, DWORD Flags);
|
---|
| 74 | WINBASEAPI VOID WINAPI InitOnceInitialize (PINIT_ONCE InitOnce);
|
---|
| 75 | WINBASEAPI WINBOOL WINAPI InitOnceExecuteOnce (PINIT_ONCE InitOnce, PINIT_ONCE_FN InitFn, PVOID Parameter, LPVOID *Context);
|
---|
| 76 | WINBASEAPI WINBOOL WINAPI InitOnceBeginInitialize (LPINIT_ONCE lpInitOnce, DWORD dwFlags, PBOOL fPending, LPVOID *lpContext);
|
---|
| 77 | WINBASEAPI WINBOOL WINAPI InitOnceComplete (LPINIT_ONCE lpInitOnce, DWORD dwFlags, LPVOID lpContext);
|
---|
| 78 | WINBASEAPI VOID WINAPI InitializeConditionVariable (PCONDITION_VARIABLE ConditionVariable);
|
---|
| 79 | WINBASEAPI VOID WINAPI WakeConditionVariable (PCONDITION_VARIABLE ConditionVariable);
|
---|
| 80 | WINBASEAPI VOID WINAPI WakeAllConditionVariable (PCONDITION_VARIABLE ConditionVariable);
|
---|
| 81 | WINBASEAPI WINBOOL WINAPI SleepConditionVariableCS (PCONDITION_VARIABLE ConditionVariable, PCRITICAL_SECTION CriticalSection, DWORD dwMilliseconds);
|
---|
| 82 | WINBASEAPI WINBOOL WINAPI SleepConditionVariableSRW (PCONDITION_VARIABLE ConditionVariable, PSRWLOCK SRWLock, DWORD dwMilliseconds, ULONG Flags);
|
---|
| 83 | WINBASEAPI HANDLE WINAPI CreateMutexExA (LPSECURITY_ATTRIBUTES lpMutexAttributes, LPCSTR lpName, DWORD dwFlags, DWORD dwDesiredAccess);
|
---|
| 84 | WINBASEAPI HANDLE WINAPI CreateMutexExW (LPSECURITY_ATTRIBUTES lpMutexAttributes, LPCWSTR lpName, DWORD dwFlags, DWORD dwDesiredAccess);
|
---|
| 85 | WINBASEAPI HANDLE WINAPI CreateEventExA (LPSECURITY_ATTRIBUTES lpEventAttributes, LPCSTR lpName, DWORD dwFlags, DWORD dwDesiredAccess);
|
---|
| 86 | WINBASEAPI HANDLE WINAPI CreateEventExW (LPSECURITY_ATTRIBUTES lpEventAttributes, LPCWSTR lpName, DWORD dwFlags, DWORD dwDesiredAccess);
|
---|
| 87 | WINBASEAPI HANDLE WINAPI CreateSemaphoreExW (LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, LONG lMaximumCount, LPCWSTR lpName, DWORD dwFlags, DWORD dwDesiredAccess);
|
---|
| 88 |
|
---|
| 89 | #define CreateMutexEx __MINGW_NAME_AW(CreateMutexEx)
|
---|
| 90 | #define CreateEventEx __MINGW_NAME_AW(CreateEventEx)
|
---|
| 91 | #ifdef UNICODE
|
---|
| 92 | #define CreateSemaphoreEx CreateSemaphoreExW
|
---|
| 93 | #endif
|
---|
| 94 | #endif
|
---|
| 95 |
|
---|
| 96 | #ifdef UNICODE
|
---|
| 97 | #define OpenMutex OpenMutexW
|
---|
| 98 | #define OpenSemaphore OpenSemaphoreW
|
---|
| 99 | #endif
|
---|
| 100 | #define OpenEvent __MINGW_NAME_AW(OpenEvent)
|
---|
| 101 |
|
---|
| 102 | typedef VOID (APIENTRY *PTIMERAPCROUTINE) (LPVOID lpArgToCompletionRoutine, DWORD dwTimerLowValue, DWORD dwTimerHighValue);
|
---|
| 103 |
|
---|
| 104 | typedef RTL_BARRIER SYNCHRONIZATION_BARRIER;
|
---|
| 105 | typedef PRTL_BARRIER PSYNCHRONIZATION_BARRIER;
|
---|
| 106 | typedef PRTL_BARRIER LPSYNCHRONIZATION_BARRIER;
|
---|
| 107 |
|
---|
| 108 | #define SYNCHRONIZATION_BARRIER_FLAGS_SPIN_ONLY 0x01
|
---|
| 109 | #define SYNCHRONIZATION_BARRIER_FLAGS_BLOCK_ONLY 0x02
|
---|
| 110 | #define SYNCHRONIZATION_BARRIER_FLAGS_NO_DELETE 0x04
|
---|
| 111 |
|
---|
| 112 | WINBASEAPI VOID WINAPI InitializeCriticalSection (LPCRITICAL_SECTION lpCriticalSection);
|
---|
| 113 | WINBASEAPI WINBOOL WINAPI InitializeCriticalSectionAndSpinCount (LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount);
|
---|
| 114 | WINBASEAPI DWORD WINAPI SetCriticalSectionSpinCount (LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount);
|
---|
| 115 | WINBASEAPI DWORD WINAPI WaitForSingleObject (HANDLE hHandle, DWORD dwMilliseconds);
|
---|
| 116 | WINBASEAPI DWORD WINAPI SleepEx (DWORD dwMilliseconds, WINBOOL bAlertable);
|
---|
| 117 | WINBASEAPI HANDLE WINAPI CreateMutexA (LPSECURITY_ATTRIBUTES lpMutexAttributes, WINBOOL bInitialOwner, LPCSTR lpName);
|
---|
| 118 | WINBASEAPI HANDLE WINAPI CreateMutexW (LPSECURITY_ATTRIBUTES lpMutexAttributes, WINBOOL bInitialOwner, LPCWSTR lpName);
|
---|
| 119 | WINBASEAPI HANDLE WINAPI CreateEventA (LPSECURITY_ATTRIBUTES lpEventAttributes, WINBOOL bManualReset, WINBOOL bInitialState, LPCSTR lpName);
|
---|
| 120 | WINBASEAPI HANDLE WINAPI CreateEventW (LPSECURITY_ATTRIBUTES lpEventAttributes, WINBOOL bManualReset, WINBOOL bInitialState, LPCWSTR lpName);
|
---|
| 121 | WINBASEAPI WINBOOL WINAPI SetWaitableTimer (HANDLE hTimer, const LARGE_INTEGER *lpDueTime, LONG lPeriod, PTIMERAPCROUTINE pfnCompletionRoutine, LPVOID lpArgToCompletionRoutine, WINBOOL fResume);
|
---|
| 122 | WINBASEAPI WINBOOL WINAPI CancelWaitableTimer (HANDLE hTimer);
|
---|
| 123 | WINBASEAPI HANDLE WINAPI OpenWaitableTimerW (DWORD dwDesiredAccess, WINBOOL bInheritHandle, LPCWSTR lpTimerName);
|
---|
| 124 | WINBOOL WINAPI EnterSynchronizationBarrier (LPSYNCHRONIZATION_BARRIER lpBarrier, DWORD dwFlags);
|
---|
| 125 | WINBOOL WINAPI InitializeSynchronizationBarrier (LPSYNCHRONIZATION_BARRIER lpBarrier, LONG lTotalThreads, LONG lSpinCount);
|
---|
| 126 | WINBOOL WINAPI DeleteSynchronizationBarrier (LPSYNCHRONIZATION_BARRIER lpBarrier);
|
---|
| 127 | WINBASEAPI VOID WINAPI Sleep (DWORD dwMilliseconds);
|
---|
| 128 | WINBASEAPI DWORD WINAPI SignalObjectAndWait (HANDLE hObjectToSignal, HANDLE hObjectToWaitOn, DWORD dwMilliseconds, WINBOOL bAlertable);
|
---|
| 129 | #if _WIN32_WINNT >= 0x0600
|
---|
| 130 | #define CREATE_WAITABLE_TIMER_MANUAL_RESET 0x1
|
---|
| 131 | WINBASEAPI HANDLE WINAPI CreateWaitableTimerExW (LPSECURITY_ATTRIBUTES lpTimerAttributes, LPCWSTR lpTimerName, DWORD dwFlags, DWORD dwDesiredAccess);
|
---|
| 132 |
|
---|
| 133 | #ifdef UNICODE
|
---|
| 134 | #define CreateWaitableTimerEx CreateWaitableTimerExW
|
---|
| 135 | #endif
|
---|
| 136 | #endif
|
---|
| 137 |
|
---|
| 138 | #if _WIN32_WINNT >= 0x0601
|
---|
| 139 | WINBOOL WINAPI SetWaitableTimerEx (HANDLE hTimer, const LARGE_INTEGER *lpDueTime, LONG lPeriod, PTIMERAPCROUTINE pfnCompletionRoutine, LPVOID lpArgToCompletionRoutine, PREASON_CONTEXT WakeContext, ULONG TolerableDelay);
|
---|
| 140 | #endif
|
---|
| 141 |
|
---|
| 142 | #define CreateMutex __MINGW_NAME_AW(CreateMutex)
|
---|
| 143 | #define CreateEvent __MINGW_NAME_AW(CreateEvent)
|
---|
| 144 |
|
---|
| 145 | #ifdef UNICODE
|
---|
| 146 | #define OpenWaitableTimer OpenWaitableTimerW
|
---|
| 147 | #endif
|
---|
| 148 |
|
---|
| 149 | #ifdef __cplusplus
|
---|
| 150 | }
|
---|
| 151 | #endif
|
---|
| 152 | #endif
|
---|