aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/vespa/vespalib/net/native_epoll.h
blob: c7c50e149fb2a6d58f58b5a16299f7396238916f (plain) (blame)
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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <sys/epoll.h>

namespace vespalib {

/**
 * The Epoll class is a thin wrapper around the epoll related system
 * calls.
 **/
class Epoll
{
private:
    int _epoll_fd;
public:
    Epoll();
    ~Epoll();
    void add(int fd, void *ctx, bool read, bool write);
    void update(int fd, void *ctx, bool read, bool write);
    void remove(int fd);
    size_t wait(epoll_event *events, size_t max_events, int timeout_ms);
};

}