From: Vladimir T. <vtz...@gm...> - 2017-06-05 04:42:48
|
On Mon, Jun 5, 2017 at 12:24 AM, Compro Prasad <com...@gm...> wrote: > I don't see the point in having "xmutex_t" defined as "xlock_t" and > "xmutex_raw_t" defined as "pthread_mutex_t". I mean how is xmutex_t > related to xmutex_raw_t ? I see it as a redundant definition which > makes the real definition look clumsy. > xlock_t helps to implement THREAD-INTERRUPT (and thus CALL-WITH-TIMEOUT, THREAD-KILL) in safe way. THREAD-INTERRUPT is implemented by sending SIGUSR1 to the thread which then is interrupted at so called GC_SAFE regions. Waiting with pthread_mutex_lock is such GC_SAFE region but interrupting it may/will leave the pthread_mutex_t internals in inconsistent state. xlock_t helps with unblocking threads waiting on mutexes when interrupt should be handled. |