[PATCH] timer_* and SIGEV_NONE
Jakub Jelinek
jakub@redhat.com
Wed Sep 12 05:39:00 GMT 2001
Hi!
Although timer_create creates a timer with SIGEV_NONE signalling just fine,
timer_settime or timer_delete on such timer causes crashes.
See http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=53494
Fixed thusly:
2001-09-12 Jakub Jelinek <jakub@redhat.com>
* sysdeps/pthread/timer_delete.c (timer_delete): Thread may be NULL
for SIGEV_NONE.
* sysdeps/pthread/timer_settime.c (timer_settime): Likewise.
--- libc/linuxthreads/sysdeps/pthread/timer_delete.c.jj Wed Jun 21 06:34:21 2000
+++ libc/linuxthreads/sysdeps/pthread/timer_delete.c Wed Sep 12 10:38:16 2001
@@ -41,10 +41,9 @@ timer_delete (timerid)
__set_errno (EINVAL);
else
{
- if (timer->armed)
+ if (timer->armed && timer->thread)
{
struct thread_node *thread = timer->thread;
- assert (thread != NULL);
/* If thread is cancelled while waiting for handler to terminate,
the mutex is unlocked and timer_delete is aborted. */
--- libc/linuxthreads/sysdeps/pthread/timer_settime.c.jj Tue Jun 20 02:33:55 2000
+++ libc/linuxthreads/sysdeps/pthread/timer_settime.c Wed Sep 12 10:48:57 2001
@@ -118,7 +118,8 @@ timer_settime (timerid, flags, value, ov
/* Only need to wake up the thread if timer is inserted
at the head of the queue. */
- need_wakeup = __timer_thread_queue_timer (thread, timer);
+ if (thread != NULL)
+ need_wakeup = __timer_thread_queue_timer (thread, timer);
timer->armed = 1;
}
Jakub
More information about the Libc-hacker
mailing list