digitalmars.D - Semaphores and the GC.
- Dave (11/11) Mar 31 2006 Both windows and linux semaphores will not work correctly in the presenc...
- Frank Benoit (4/4) Mar 31 2006 On linux, if you use semaphores.
- Sean Kelly (3/7) Mar 31 2006 Sounds like a good reason to provide a wrapper for semaphores in D.
Both windows and linux semaphores will not work correctly in the presence of the GC when it 'stops and restarts' the world (or at least I've not been able to get something working). The problem appears to be from pausing and/or resuming threads. I've tried all of native POSIX semaphores and pthread mutex/conditions on Linux, and Windows API Semaphores. They all work up and until a GC happens or threads are paused and resumed in some other way. Anyone out there have any ideas on how to implement POSIX semaphore-like functionality that will work w/ the GC? Thanks, - Dave
Mar 31 2006
On linux, if you use semaphores. The GC sends SIGUSR1 & SIGUSR2 to all threads for pausing and resuming. The semaphores will wake up with error EINTR. You only have to check for that, and wait again.
Mar 31 2006
Frank Benoit wrote:On linux, if you use semaphores. The GC sends SIGUSR1 & SIGUSR2 to all threads for pausing and resuming. The semaphores will wake up with error EINTR. You only have to check for that, and wait again.Sounds like a good reason to provide a wrapper for semaphores in D. Sean
Mar 31 2006