-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEventNotifier.hpp
More file actions
35 lines (29 loc) · 1.03 KB
/
EventNotifier.hpp
File metadata and controls
35 lines (29 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*******************************************************************************
* libunix++: C++ wrapper for Linux system calls
* Event notifier operations
*
* © 2019—2023, Sauron <libunixpp@saur0n.science>
******************************************************************************/
#ifndef __UNIXPP_EVENTNOTIFIER_HPP
#define __UNIXPP_EVENTNOTIFIER_HPP
#include <sys/eventfd.h>
#include "Stream.hpp"
namespace upp {
/** File descriptor for event notification **/
class EventNotifier : public Stream {
public:
/** Set the close-on-exec flag on a new file descriptor **/
static const int CLOEXEC=EFD_CLOEXEC;
/**/
static const int NONBLOCK=EFD_NONBLOCK;
/** Provide semaphore-like semantics for reads **/
static const int SEMAPHORE=EFD_SEMAPHORE;
/** Create file descriptor for event notification **/
EventNotifier(unsigned int initval, int flags);
/** Return the counter value **/
eventfd_t readCounter();
/** Add to the counter value **/
void writeCounter(eventfd_t off);
};
}
#endif