Dobby 3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
Loading...
Searching...
No Matches
IPollLoop.h
1/*
2* If not stated otherwise in this file or this component's LICENSE file the
3* following copyright and licenses apply:
4*
5* Copyright 2015 Sky UK
6*
7* Licensed under the Apache License, Version 2.0 (the "License");
8* you may not use this file except in compliance with the License.
9* You may obtain a copy of the License at
10*
11* http://www.apache.org/licenses/LICENSE-2.0
12*
13* Unless required by applicable law or agreed to in writing, software
14* distributed under the License is distributed on an "AS IS" BASIS,
15* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16* See the License for the specific language governing permissions and
17* limitations under the License.
18*/
19/*
20 * File: IPollLoop.h
21 *
22 */
23#ifndef IPOLLLOOP_H
24#define IPOLLLOOP_H
25
26#include <stdint.h>
27#include <sys/types.h>
28#include <sys/epoll.h>
29
30#include <memory>
31#include <thread>
32
33#define EPOLLDEFERRED (1 << 29)
34
35namespace AICommon {
36
37class IPollLoop;
38
40{
41public:
42 virtual ~IPollSource() { }
43
44public:
45 virtual void process(const std::shared_ptr<IPollLoop>& pollLoop, epoll_event event) = 0;
46};
47
49{
50public:
51 virtual ~IPollLoop() { }
52
53public:
54 virtual bool start(int priority = -1) = 0;
55 virtual void stop() = 0;
56
57 virtual std::thread::id threadId() const = 0;
58 virtual pid_t gettid() const = 0;
59
60 virtual bool addSource(const std::shared_ptr<IPollSource>& source, int fd, uint32_t events) = 0;
61 virtual bool modSource(const std::shared_ptr<IPollSource>& source, uint32_t events) = 0;
62 virtual void delSource(const std::shared_ptr<IPollSource>& source, int fd = -1) = 0;
63 virtual bool hasSource(const std::shared_ptr<IPollSource>& source) = 0;
64};
65
66} // namespace AICommon
67
68#endif // !defined(IPOLLLOOP_H)
Definition IPollLoop.h:49
Definition IPollLoop.h:40