blob: 83dca4c656597b2460446255b2fe38516836087d (
plain)
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
37
38
39
40
41
42
43
44
45
46
47
|
#pragma once
#include <thread>
namespace saw {
namespace rmt {
struct Thread {};
}
template<>
class device<rmt::Thread> final {
private:
event_loop ev_loop_;
std::thread thread_;
bool keep_running_;
void run(){
wait_scope wait{ev_loop_};
while(keep_running_){
wait.wait(std::chrono::seconds{4u});
}
}
public:
device():
ev_loop_{},
thread_{&device<rmt::Thread>::run, this},
keep_running_{true}
{
}
};
template<>
class remote<rmt::Thread> final {
private:
public:
remote() = default;
conveyor<own<remote_address<rmt::Thread>>> resolve_address(){
return heap<remote_address<rmt::Thread>>(*this);
}
device<rmt::Thread> connect_device(const remote_address<rmt::Thread>& ){
return {};
}
};
}
|