Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2013-07-23 18:15:20 +0400
committerCorinna Vinschen <corinna@vinschen.de>2013-07-23 18:15:20 +0400
commit16efa64721b0dd9cfc699ce4b3928a8e7644b980 (patch)
treec345d7373cd6b5e3f8fd3ce559ff2211a7d7f534 /winsup/cygwin/thread.h
parent6c1f4d7d644d6199f5ecc6c542addda657cad600 (diff)
* 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/thread.h')
-rw-r--r--winsup/cygwin/thread.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/winsup/cygwin/thread.h b/winsup/cygwin/thread.h
index c87c620eb..badffcb79 100644
--- a/winsup/cygwin/thread.h
+++ b/winsup/cygwin/thread.h
@@ -638,6 +638,7 @@ public:
HANDLE win32_obj_id;
int shared;
LONG currentvalue;
+ LONG startvalue;
int fd;
unsigned long long hash;
LUID luid;
@@ -648,6 +649,10 @@ public:
~semaphore ();
class semaphore * next;
+ static void fixup_before_fork ()
+ {
+ semaphores.for_each (&semaphore::_fixup_before_fork);
+ }
static void fixup_after_fork ()
{
semaphores.fixup_after_fork ();
@@ -666,6 +671,7 @@ private:
int _trywait ();
int _timedwait (const struct timespec *abstime);
+ void _fixup_before_fork ();
void _fixup_after_fork ();
void _terminate ();