summaryrefslogtreecommitdiffstats
path: root/winsup/cygserver/sysv_sem.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2017-03-24 16:45:32 +0100
committerCorinna Vinschen <corinna@vinschen.de>2017-03-24 17:53:34 +0100
commitb80b2c011936f7f075b76b6e59f9e8a5ec49caa1 (patch)
treeb545ab1c0bfcbe015221bfdd268a621cf83bf17c /winsup/cygserver/sysv_sem.cc
parent0b73dba4de3fdadde499edfbc7ca9d9a01c11487 (diff)
downloadcygnal-b80b2c011936f7f075b76b6e59f9e8a5ec49caa1.tar.gz
cygnal-b80b2c011936f7f075b76b6e59f9e8a5ec49caa1.tar.bz2
cygnal-b80b2c011936f7f075b76b6e59f9e8a5ec49caa1.zip
cygserver: Revamp thread sleep handling
The current implementation is a very simple approach to implement a statically sized sleep queue. The problem is that this code requires a certain amount of synchronization because the slots in the queue are used dynamically. To top it off, the Event objects used for sync'ing are created and destroyed on demand. This is complicated, slow, and error prone. There's also a blatant bug here: The number of slots in the queue was wrongly computed in size. It was too small if XSI IPC was used a lot. Make the code more robust. Let the queue have the right size. Every slot is now used for a specific IPC object. All sync objects (switched to Semaphores) are only created when first required, but never destroyed. This reduces the usage of a critical section to the creation of a new sync object. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup/cygserver/sysv_sem.cc')
-rw-r--r--winsup/cygserver/sysv_sem.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/winsup/cygserver/sysv_sem.cc b/winsup/cygserver/sysv_sem.cc
index 349322c6d..98ddbf318 100644
--- a/winsup/cygserver/sysv_sem.cc
+++ b/winsup/cygserver/sysv_sem.cc
@@ -43,6 +43,9 @@ __FBSDID("$FreeBSD: /repoman/r/ncvs/src/sys/kern/sysv_sem.c,v 1.70 2004/05/30 20
#define __semctl semctl
#define __semctl_args semctl_args
#define SEM_DEBUG
+#define _mk_semid(P) ((P) - sema)
+#define msleep(P,m,p,w,t) _msleep(SEM,_mk_semid(P),(m),(p),(w),(t))
+#define wakeup(P) _wakeup(SEM,_mk_semid(P))
#endif /* __CYGWIN__ */
#ifdef SEM_DEBUG