From b80b2c011936f7f075b76b6e59f9e8a5ec49caa1 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 24 Mar 2017 16:45:32 +0100 Subject: 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 --- winsup/cygserver/sysv_msg.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'winsup/cygserver/sysv_msg.cc') diff --git a/winsup/cygserver/sysv_msg.cc b/winsup/cygserver/sysv_msg.cc index 9e90d05a9..b3a49900e 100644 --- a/winsup/cygserver/sysv_msg.cc +++ b/winsup/cygserver/sysv_msg.cc @@ -46,6 +46,9 @@ __FBSDID("$FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/sys/kern/sysv_msg.c,v 1.5 #ifdef __CYGWIN__ #define MSG_DEBUG +#define _mk_msgid(P) ((P) - msqids) +#define msleep(P,m,p,w,t) _msleep(MSQ,_mk_msgid(P),(m),(p),(w),(t)) +#define wakeup(P) _wakeup(MSQ,_mk_msgid(P)) #endif /* __CYGWIN__ */ #ifdef MSG_DEBUG -- cgit v1.2.3