[Ecls-list] [PATCH] Fix locks and condition variables.

Alexander Gavrilov angavrilov at gmail.com
Tue Sep 29 08:32:19 UTC 2009


On Thu, Sep 24, 2009 at 12:41 AM, Juan Jose Garcia-Ripoll
<juanjose.garciaripoll at googlemail.com> wrote:
> 2009/9/23 Alexander Gavrilov <angavrilov at gmail.com>:
>> Of course, the threads should not be interrupted inside lock
>> managing functions.
>
> This is the critical point, but what if the thread waits too long and
> HAS to be interrupted?

This depends on how exactly the pthread library is implemented. It
seems that the documentation does not provide any official safe way
for interrupting waits using signals. In any case, some special
support will probably be required in the signal handler.

An additional complication is that pthread_mutex_lock will loop until
the lock is acquired (so it is necessary to longjmp out of the
handler), while cond_wait implementations are allowed to either loop
or exit after receiving a signal.

Alexander




More information about the ecl-devel mailing list