From: Vladimir T. <vtz...@gm...> - 2009-04-21 15:26:41
|
On 4/17/09, Sam Steingold <sd...@gn...> wrote: > Vladimir Tzankov wrote: >> I am considering to make significant changes to the MT code and >> exposed lisp functions: >> >> 1. do not use pthreads mutexes and condition variables (remove >> MUTEX-xxx and EXEMPTION-xxx functions) >> 2. implement locks with POSIX semaphores (these will replace MUTEX-xxxx) > > 3. expose semaphores in lisp (SEMAPHORE-xxx functions) > > do win32 threads have something similar? Yes - there are semaphores (actually win32 lacks condition variables). > does this path support waiting for an abstract condition to be satisfied? > (as the mutex+exemption did) Not directly but can be simulated/implemented (there are a lot of discussions how and while not trivial it is possible). The only reason I propose this change is because of THREAD-INTERRUPT/CALL-WITH-TIMEOUT. These two cannot be implemented (and will not work properly) with POSIX mutex and exemption without introducing undefined behavior (like now) - most probably deadlocks. Actually I wanted to cleanup signal handling and make it POSIX compliant - so came to these issues. >> 4. remove thread flavors - leave just --with-threads. We will use >> either POSIX or WIN32 threads and there is no need to configure this. > > first, this is not related to the other issues (semaphores vs mutexes), > so it can be tackled separately. > second, I am not sure this is such a good idea. > what if someone wants to use pthreads on win32? > (is there any real reason for that?) If we go with POSIX/win32 semaphores the only thing we will need from pthreads is pthread_create() (and get/setspecific for TLS). |