-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathSelectRunLoop.hpp
More file actions
35 lines (23 loc) · 792 Bytes
/
SelectRunLoop.hpp
File metadata and controls
35 lines (23 loc) · 792 Bytes
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
#pragma once
// Copyright © 2021 Michael Thornburgh
// SPDX-License-Identifier: MIT
#include <map>
#include <thread>
#include "RunLoop.hpp"
namespace com { namespace zenomt {
class SelectRunLoop : public RunLoop {
public:
using RunLoop::RunLoop;
using RunLoop::registerDescriptor;
using RunLoop::unregisterDescriptor;
void registerDescriptor(int fd, Condition cond, const Action &action) override;
void unregisterDescriptor(int fd, Condition cond) override;
void run(Duration runInterval = INFINITY, Duration minSleep = 0) override;
bool isRunningInThisThread() const override;
void clear() override;
struct Item;
protected:
std::map<int, std::shared_ptr<Item> > m_items[NUM_CONDITIONS];
std::atomic<std::thread::id> m_runningInThread;
};
} } // namespace com::zenomt