send can fail silently when sending would block (EWOULDBLOCK return for send) (#18)

* try to use a pipe for communication

* flush send buffer on the background thread

* cleanup

* linux fix / linux still use event fd for now

* cleanup
This commit is contained in:
Benjamin Sergeant
2019-03-13 23:09:45 -07:00
committed by GitHub
parent d6597d9f52
commit 2750df8aa7
19 changed files with 277 additions and 115 deletions

View File

@@ -6,6 +6,8 @@
#pragma once
#include <stdint.h>
namespace ix
{
class EventFd {
@@ -13,11 +15,19 @@ namespace ix
EventFd();
virtual ~EventFd();
bool notify();
bool notify(uint64_t value);
bool clear();
uint64_t read();
int getFd();
private:
#if defined(__linux__)
int _eventfd;
#else
// Store file descriptors used by the communication pipe. Communication
// happens between a control thread and a background thread, which is
// blocked on select.
int _fildes[2];
#endif
};
}