Debian Codegraph @

src/timer_posix.h

raw symbols SCIP
1 #ifndef _TIMER_POSIX_H_
2 #define _TIMER_POSIX_H_
3
4 #ifndef _WIN32
5
6 #include <functional>
7 #include "timestamp.h"
8 #include "threadutils.h"
9 #include "optional.h"
10
11 class Timer {
12 std::function<void ()> callback;
13 Mutex mutex;
14 ConditionVariable cond;
15 // Stores the handle to a bgthread, which is created upon demand. (Previously
16 // the thread was created in the constructor, but addressed sanitized (ASAN)
17 // builds of R would hang when pthread_create was called during dlopen.)
18 Optional<tct_thrd_t> bgthread;
19 Optional<Timestamp> wakeAt;
20 bool stopped;
21
22 static int bg_main_func(void*);
23 void bg_main();
24 public:
25 Timer(const std::function<void ()>& callback);
26 virtual ~Timer();
27
28 // Schedules the timer to fire next at the specified time.
29 // If the timer is currently scheduled to fire, that will
30 // be overwritten with this one (the timer only tracks one
31 // timestamp at a time).
32 void set(const Timestamp& timestamp);
33 };
34
35
36 #endif // _WIN32
37
38 #endif // _TIMER_POSIX_H_