mirror of
https://github.com/strongswan/strongswan.git
synced 2025-10-06 00:00:47 -04:00
watcher: Check for cancellation if poll() fails with EINTR
With LinuxThreads, poll() is unfortunately no cancellation point. It seems that poll gets woken up after cancellation, but we actively must check for cancellation before re-entering poll to properly shut down the watcher thread.
This commit is contained in:
parent
fc235f90fe
commit
8b0c9cf155
@ -345,6 +345,13 @@ static job_requeue_t watch(private_watcher_t *this)
|
||||
old = thread_cancelability(TRUE);
|
||||
|
||||
res = poll(pfd, count, -1);
|
||||
if (res == -1 && errno == EINTR)
|
||||
{
|
||||
/* LinuxThreads interrupts poll(), but does not make it a
|
||||
* cancellation point. Manually test if we got cancelled. */
|
||||
thread_cancellation_point();
|
||||
}
|
||||
|
||||
thread_cancelability(old);
|
||||
thread_cleanup_pop(FALSE);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user