Prev Next | OpenBSD and Rthreads | Slide #21 |
if the cancellation signal is delivered after thrsleep is called then the spinlock is no longer locked; if it's delivered before that then we need to keep thrsleep from blocking, but still release the spinlock
int thrsleep(void *ident, clockid_t clock_id, const struct timespec *abstime, void *lock, const int *abort);
if *abort is non-zero after unlocking the spinlock, thrsleep() will return EINTR as-if the cancellation signal had occurred after the entry into the kernel
The signal handler for cancellation, when this can occur, just set that flag and returns instead of trying to call pthread_exit(PTHREAD_CANCELED)
EuroBSDCon 2012 | Copyright © 2012 Philip Guenther |