-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
37 lines (34 loc) · 1.07 KB
/
main.cpp
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
#include <iostream>
#include "multitimeout.h"
void multitimeout_event_handler(el_async::Multitimeout* mt, int tmr, void* arg0, int arg1) {
(void)mt;
(void)tmr;
(void)arg0;
(void)arg1;
std::cout << "Timer expired: " << int(tmr) << std::endl;
}
int main()
{
el_async::Multitimeout mt;
mt.bind_event_handler(multitimeout_event_handler);
el_async::Multitimeout::ms_t tmr[128];
el_async::Multitimeout::ms_t tmr_reload[128];
bool mem0[128];
bool mem1[128];
bool mem2[128];
bool mem3[128];
mt.bind_memory(128, tmr, tmr_reload, mem0, mem1, mem2, mem3);
for (int i = 0; i < 128; i++) {
tmr[i] = std::chrono::milliseconds(0);
tmr_reload[i] = std::chrono::milliseconds(0);
mem0[i] = 0;
mem1[i] = 0;
mem2[i] = 0;
mem3[i] = 0;
}
std::cout << "Hello World!\n";
mt.add(0, std::chrono::milliseconds(10000), false);
std::this_thread::sleep_for(std::chrono::milliseconds(5000));
mt.add(1, std::chrono::milliseconds(10000), false);
while (69);
}