
On 08/11/2013 11:43, Renato Forti wrote:
class selfpipe : noncopyable { protected: void setup() { pipe(fd_); fcntl(fd_[READ_FD], F_SETFL, fcntl(fd_[READ_FD], F_GETFL) | O_NONBLOCK); fcntl(fd_[WRITE_FD], F_SETFL, fcntl(fd_[WRITE_FD], F_GETFL) | O_NONBLOCK); }
void teardown() { close(fd_[READ_FD]; close(fd_[WRITE_FD]; }
public: int readfd() const { return fd_[READ_FD]; } void poke() { write(fd_[WRITE_FD], "", 1); }
private: enum { READ_FD = 0, WRITE_FD = 1 }; int fd_[2]; };
How is that supposed to work in Windows? (Does it need to?) Its sensible to expose 'something' that can be integrated to native event loops, but the ideal choice under Windows is probably an event, not a pipe descriptor. I think some analysis is needed.