fix race condition in SelectInteruptPipe, where _fildes are not protected (caught by fedora tsan)

This commit is contained in:
Benjamin Sergeant
2019-05-11 11:45:20 -07:00
parent 93b901a286
commit c8c1aabf20
3 changed files with 10 additions and 7 deletions

View File

@ -10,6 +10,7 @@
#include <stdint.h>
#include <string>
#include <mutex>
namespace ix
{
@ -30,6 +31,7 @@ namespace ix
// happens between a control thread and a background thread, which is
// blocked on select.
int _fildes[2];
mutable std::mutex _fildesMutex;
// Used to identify the read/write idx
static const int kPipeReadIndex;