Pierre, I think I tracked the problem down, reported in
http://cygwin.com/ml/cygwin/2004-12/msg00236.html I'm asking you since you were the one introducing cwdstuff->get_drive(). I found that the problem was raised by just using threads, nothing to do with Semaphores, and only if a thread accesses cwdstuff one way or the other. A simple example for the hang is a thread which immediately calls getcwd(). AFAICS there's a muto release missing in cwdstuff->get_drive(). This patch solves Andrew's problem: Index: cygheap.h =================================================================== RCS file: /cvs/src/src/winsup/cygwin/cygheap.h,v retrieving revision 1.93 diff -p -u -r1.93 cygheap.h --- cygheap.h 26 Nov 2004 04:15:06 -0000 1.93 +++ cygheap.h 13 Dec 2004 18:02:45 -0000 @@ -235,6 +235,7 @@ struct cwdstuff { get_initial (); memcpy (dst, win32, drive_length); + cwd_lock->release (); return drive_length; } void init (); Is that ok to apply or is there any good reason not to release the muto when get_drive() has finished? I can't see any, FWIW. Corinna > ----- Forwarded message from Andrew Que ----- > From: Andrew Que > To: cygwin > Subject: FOLLOWUP: 1.5.12: problems without registry keys > Date: Wed, 8 Dec 2004 11:10:03 -0800 (PST) > > I apologise ahead of time, I could not for the life > of me figure out how to send a reply to a thread. The > original thread is 101373: "1.5.12: problems without > registry keys" > In my original post, I noted not all apps crashed > without the registry key. So, I tried to narrow it > down. It looks like apps. that use semaphores lock up > every time. > > I attached an example of an app that will lock up > without the registry keys present. > > To compile: > gcc Semaphore.cpp -o Semaphore.exe > > (PS. The example is just a semaphore coalition test-- > and it's terrible code)