diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2017-03-24 16:45:32 +0100 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2017-03-24 17:53:34 +0100 |
commit | b80b2c011936f7f075b76b6e59f9e8a5ec49caa1 (patch) | |
tree | b545ab1c0bfcbe015221bfdd268a621cf83bf17c /winsup/cygserver/sysv_shm.cc | |
parent | 0b73dba4de3fdadde499edfbc7ca9d9a01c11487 (diff) | |
download | cygnal-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_shm.cc')
-rw-r--r-- | winsup/cygserver/sysv_shm.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/winsup/cygserver/sysv_shm.cc b/winsup/cygserver/sysv_shm.cc index 4578c53a2..05acc2ee6 100644 --- a/winsup/cygserver/sysv_shm.cc +++ b/winsup/cygserver/sysv_shm.cc @@ -60,6 +60,12 @@ __FBSDID("$FreeBSD: /repoman/r/ncvs/src/sys/kern/sysv_shm.c,v 1.89 2003/11/07 04 #include "cygserver_ipc.h" #ifdef __CYGWIN__ +#define _mk_shmid(P) ((P) - shmsegs) +#define tsleep(P,p,w,t) _tsleep(SHM,_mk_shmid(P),(p),(w),(t)) +#define wakeup(P) _wakeup(SHM,_mk_shmid(P)) +#endif + +#ifdef __CYGWIN__ #ifndef PAGE_SIZE #define PAGE_SIZE (getpagesize ()) #endif |