IXWebSocket/ixwebsocket/IXEventFd.h

34 lines
645 B
C
Raw Normal View History

2018-11-07 21:24:08 +01:00
/*
* IXEventFd.h
* Author: Benjamin Sergeant
* Copyright (c) 2018 Machine Zone, Inc. All rights reserved.
*/
#pragma once
#include <stdint.h>
namespace ix
2018-11-07 21:24:08 +01:00
{
class EventFd {
public:
EventFd();
virtual ~EventFd();
bool notify(uint64_t value);
2018-11-07 21:24:08 +01:00
bool clear();
uint64_t read();
2018-11-07 21:24:08 +01:00
int getFd();
private:
#if defined(__linux__)
2018-11-07 21:24:08 +01:00
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
2018-11-07 21:24:08 +01:00
};
}