[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Readline: Signals get re-sent to the wrong thread
From: |
Wolfgang Thaller |
Subject: |
Readline: Signals get re-sent to the wrong thread |
Date: |
Wed, 1 Oct 2003 08:13:22 +0200 |
When readline catches a signal, it often passes it on to the
application. However, the signal can get passed on to the _wrong
thread_. This doesn't matter for most applications, but when
applications use pthread_kill specifically, this can become (almost) a
show-stopper.
In the file signal.c, the signal is sent on using:
kill (getpid (), sig);
This resends the signal to the "any" thread of the application; what I
would prefer is the following:
pthread_kill(pthread_self(), sig);
On Linux, where each thread has it's own PID, the two are equivalent,
but on Mac OS X, the second passes the signal on correctly; in the
first case, the signal might end up being handled by a different
thread.
Cheers,
Wolfgang
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Readline: Signals get re-sent to the wrong thread,
Wolfgang Thaller <=