-
Notifications
You must be signed in to change notification settings - Fork 3
/
POSIX.hpp
36 lines (27 loc) · 1.11 KB
/
POSIX.hpp
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
36
#ifndef POSIX_DOT_HPP
#define POSIX_DOT_HPP
#include <chrono>
#include <functional>
#include <ios>
#include <unistd.h>
constexpr void null_hook(void) {}
class POSIX {
public:
POSIX() = delete;
POSIX(POSIX const&) = delete;
static void set_nonblocking(int fd);
static bool input_ready(int fd_in, std::chrono::milliseconds wait);
static bool output_ready(int fd_out, std::chrono::milliseconds wait);
static std::streamsize read(int fd,
char* s,
std::streamsize n,
std::function<void(void)> read_hook,
std::chrono::milliseconds timeout,
bool& t_o);
static std::streamsize write(int fd,
const char* s,
std::streamsize n,
std::chrono::milliseconds timeout,
bool& t_o);
};
#endif // POSIX_DOT_HPP