From f934a09baaa360de742d96bf359f7de8472b4702 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Wed, 18 Nov 2020 22:32:57 -0500 Subject: [PATCH] Build fix. --- osdep/LinuxEthernetTap.cpp | 7 ++++--- osdep/LinuxEthernetTap.hpp | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/osdep/LinuxEthernetTap.cpp b/osdep/LinuxEthernetTap.cpp index 04871193f..8a557c077 100644 --- a/osdep/LinuxEthernetTap.cpp +++ b/osdep/LinuxEthernetTap.cpp @@ -185,7 +185,7 @@ LinuxEthernetTap::LinuxEthernetTap( (void)::pipe(_shutdownSignalPipe); for(unsigned int t=0;t<2;++t) { - _tapReaderThread = std::thread([this, t]{ + _tapReaderThread[t] = std::thread([this, t]{ fd_set readfds,nullfds; int n,nfds,r; void *buf = nullptr; @@ -324,14 +324,15 @@ LinuxEthernetTap::LinuxEthernetTap( LinuxEthernetTap::~LinuxEthernetTap() { - (void)::write(_shutdownSignalPipe[1],"\0",1); // causes reader thread to exit + (void)::write(_shutdownSignalPipe[1],"\0",1); // causes reader thread(s) to exit _tapq.post(std::pair(nullptr,0)); // causes processor thread to exit ::close(_fd); ::close(_shutdownSignalPipe[0]); ::close(_shutdownSignalPipe[1]); - _tapReaderThread.join(); + _tapReaderThread[0].join(); + _tapReaderThread[1].join(); _tapProcessorThread.join(); for(std::vector::iterator i(_buffers.begin());i!=_buffers.end();++i) diff --git a/osdep/LinuxEthernetTap.hpp b/osdep/LinuxEthernetTap.hpp index 9e9206ead..a21a53a2c 100644 --- a/osdep/LinuxEthernetTap.hpp +++ b/osdep/LinuxEthernetTap.hpp @@ -70,7 +70,7 @@ private: int _fd; int _shutdownSignalPipe[2]; std::atomic_bool _enabled; - std::thread _tapReaderThread; + std::thread _tapReaderThread[2]; std::thread _tapProcessorThread; std::mutex _buffers_l; std::vector _buffers;