(empth_start, empth_init, empth_alarm) [_EMPTH_POSIX]: We do raise

SIGALRM!  Revert rev. 1.21.

(empth_alarm): Internal linkage.
This commit is contained in:
Markus Armbruster 2005-12-09 20:52:30 +00:00
parent 16fe285ec7
commit a540be8fe3

View file

@ -88,7 +88,7 @@ static void **udata;
static pthread_mutex_t mtx_ctxsw;
static void empth_status(char *format, ...) ATTRIBUTE((format (printf, 1, 2)));
static void empth_alarm(int sig);
static void *
empth_start(void *arg)
@ -110,6 +110,9 @@ empth_start(void *arg)
act.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &act, NULL);
act.sa_handler = empth_alarm;
sigaction(SIGALRM, &act, NULL);
ctx->id = pthread_self();
pthread_setspecific(ctx_key, ctx);
pthread_mutex_lock(&mtx_ctxsw);
@ -154,11 +157,17 @@ int
empth_init(void **ctx_ptr, int flags)
{
empth_t *ctx;
struct sigaction act;
pthread_key_create(&ctx_key, NULL);
pthread_mutex_init(&mtx_ctxsw, NULL);
act.sa_flags = 0;
sigemptyset(&act.sa_mask);
act.sa_handler = empth_alarm;
sigaction(SIGALRM, &act, NULL);
udata = ctx_ptr;
ctx = malloc(sizeof(empth_t));
if (!ctx) {
@ -354,6 +363,19 @@ empth_select(int fd, int flags)
}
static void
empth_alarm(int sig)
{
struct sigaction act;
empth_status("got alarm signal");
#ifdef SA_RESTART
act.sa_flags &= ~SA_RESTART;
#endif
sigemptyset(&act.sa_mask);
act.sa_handler = empth_alarm;
sigaction(SIGALRM, &act, NULL);
}
void
empth_wakeup(empth_t *a)
{