diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2013-07-23 14:15:20 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2013-07-23 14:15:20 +0000 |
commit | 16efa64721b0dd9cfc699ce4b3928a8e7644b980 (patch) | |
tree | c345d7373cd6b5e3f8fd3ce559ff2211a7d7f534 /winsup/cygwin/ntdll.h | |
parent | 6c1f4d7d644d6199f5ecc6c542addda657cad600 (diff) | |
download | cygnal-16efa64721b0dd9cfc699ce4b3928a8e7644b980.tar.gz cygnal-16efa64721b0dd9cfc699ce4b3928a8e7644b980.tar.bz2 cygnal-16efa64721b0dd9cfc699ce4b3928a8e7644b980.zip |
* ntdll.h (struct _SEMAPHORE_BASIC_INFORMATION): Define.
(enum _SEMAPHORE_INFORMATION_CLASS): Define.
(NtQuerySemaphore): Declare.
* thread.h (class semaphore): Add member startvalue.
(semaphore::fixup_before_fork): New inline method.
(semaphore::_fixup_before_fork): Declare.
* thread.cc (MTinterface::fixup_before_fork): Additionally call
semaphore::fixup_before_fork.
(semaphore::semaphore): Set currentvalue to -1. Set startvalue to
incoming initializer value.
(semaphore::_getvalue): Just query semaphore using NtQuerySemaphore
rather then using WFSO/Release.
(semaphore::_post): Drop setting currentvalue. It's not thread-safe.
(semaphore::_trywait): Ditto.
(semaphore::_timedwait): Ditto.
(semaphore::_wait): Ditto.
(semaphore::_fixup_before_fork): New method, setting currentvalue from
actual windows semaphore right before fork.
(semaphore::_fixup_after_fork): Drop kludge from 2013-07-10. Drop
FIXME comment.
Diffstat (limited to 'winsup/cygwin/ntdll.h')
-rw-r--r-- | winsup/cygwin/ntdll.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/winsup/cygwin/ntdll.h b/winsup/cygwin/ntdll.h index 2582bf25f..c67a775ec 100644 --- a/winsup/cygwin/ntdll.h +++ b/winsup/cygwin/ntdll.h @@ -1102,6 +1102,18 @@ typedef enum _EVENT_INFORMATION_CLASS EventBasicInformation = 0 } EVENT_INFORMATION_CLASS, *PEVENT_INFORMATION_CLASS; +/* Checked on 64 bit. */ +typedef struct _SEMAPHORE_BASIC_INFORMATION +{ + LONG CurrentCount; + LONG MaximumCount; +} SEMAPHORE_BASIC_INFORMATION, *PSEMAPHORE_BASIC_INFORMATION; + +typedef enum _SEMAPHORE_INFORMATION_CLASS +{ + SemaphoreBasicInformation = 0 +} SEMAPHORE_INFORMATION_CLASS, *PSEMAPHORE_INFORMATION_CLASS; + typedef enum _THREAD_INFORMATION_CLASS { ThreadBasicInformation = 0, @@ -1275,6 +1287,8 @@ extern "C" PVOID, ULONG, PULONG); NTSTATUS NTAPI NtQueryObject (HANDLE, OBJECT_INFORMATION_CLASS, VOID *, ULONG, ULONG *); + NTSTATUS NTAPI NtQuerySemaphore (HANDLE, SEMAPHORE_INFORMATION_CLASS, + PVOID, ULONG, PULONG); NTSTATUS NTAPI NtQuerySystemInformation (SYSTEM_INFORMATION_CLASS, PVOID, ULONG, PULONG); NTSTATUS WINAPI NtQuerySystemTime (PLARGE_INTEGER); |