Build fix.

This commit is contained in:
Adam Ierymenko 2020-11-18 22:32:57 -05:00
parent 414c248cc5
commit f934a09baa
No known key found for this signature in database
GPG Key ID: C8877CF2D7A5D7F3
2 changed files with 5 additions and 4 deletions

View File

@ -185,7 +185,7 @@ LinuxEthernetTap::LinuxEthernetTap(
(void)::pipe(_shutdownSignalPipe); (void)::pipe(_shutdownSignalPipe);
for(unsigned int t=0;t<2;++t) { for(unsigned int t=0;t<2;++t) {
_tapReaderThread = std::thread([this, t]{ _tapReaderThread[t] = std::thread([this, t]{
fd_set readfds,nullfds; fd_set readfds,nullfds;
int n,nfds,r; int n,nfds,r;
void *buf = nullptr; void *buf = nullptr;
@ -324,14 +324,15 @@ LinuxEthernetTap::LinuxEthernetTap(
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<void *,int>(nullptr,0)); // causes processor thread to exit _tapq.post(std::pair<void *,int>(nullptr,0)); // causes processor thread to exit
::close(_fd); ::close(_fd);
::close(_shutdownSignalPipe[0]); ::close(_shutdownSignalPipe[0]);
::close(_shutdownSignalPipe[1]); ::close(_shutdownSignalPipe[1]);
_tapReaderThread.join(); _tapReaderThread[0].join();
_tapReaderThread[1].join();
_tapProcessorThread.join(); _tapProcessorThread.join();
for(std::vector<void *>::iterator i(_buffers.begin());i!=_buffers.end();++i) for(std::vector<void *>::iterator i(_buffers.begin());i!=_buffers.end();++i)

View File

@ -70,7 +70,7 @@ private:
int _fd; int _fd;
int _shutdownSignalPipe[2]; int _shutdownSignalPipe[2];
std::atomic_bool _enabled; std::atomic_bool _enabled;
std::thread _tapReaderThread; std::thread _tapReaderThread[2];
std::thread _tapProcessorThread; std::thread _tapProcessorThread;
std::mutex _buffers_l; std::mutex _buffers_l;
std::vector<void *> _buffers; std::vector<void *> _buffers;