From 19aabdfacfa3c41bd3dad7280b19ff43fc2da770 Mon Sep 17 00:00:00 2001 From: Paul Hollinsky Date: Thu, 27 May 2021 22:47:44 -0400 Subject: [PATCH] POSIX: PCAP: Cancel after pcap_breakloop() to EINTR out of poll() This is necessary as pcap_breakloop() does not actually wake the thread from blocking operations, such as poll. --- platform/posix/pcap.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/platform/posix/pcap.cpp b/platform/posix/pcap.cpp index 85a5eed..67ffc27 100644 --- a/platform/posix/pcap.cpp +++ b/platform/posix/pcap.cpp @@ -234,6 +234,7 @@ bool PCAP::close() { closing = true; // Signal the threads that we are closing pcap_breakloop(interface.fp); + pthread_cancel(readThread.native_handle()); readThread.join(); writeThread.join(); closing = false;