13namespace sysio {
namespace chain {
15static_assert(std::atomic_bool::is_always_lock_free,
"Only lock-free atomics AS-safe.");
23 self->call_expiration_callback();
28 static_assert(
sizeof(impl) <= fwd_size);
30 static bool initialized;
31 static std::mutex initalized_mutex;
33 if(std::lock_guard guard(initalized_mutex); !initialized) {
35 sigemptyset(&act.sa_mask);
37 act.sa_flags = SA_SIGINFO | SA_RESTART;
38 FC_ASSERT(sigaction(SIGRTMIN, &act, NULL) == 0,
"failed to aquire SIGRTMIN signal");
43 se.sigev_notify = SIGEV_SIGNAL;
44 se.sigev_signo = SIGRTMIN;
45 se.sigev_value.sival_ptr = (
void*)
this;
47 FC_ASSERT(timer_create(CLOCK_REALTIME, &se, &my->timerid) == 0,
"failed to create timer");
53 timer_delete(my->timerid);
65 time_t secs = x.
count() / 1000000;
66 long nsec = (x.
count() - (secs*1000000)) * 1000;
67 struct itimerspec enable = {{0, 0}, {secs, nsec}};
69 if(timer_settime(my->timerid, 0, &enable, NULL) != 0)
77 struct itimerspec disable = {{0, 0}, {0, 0}};
78 timer_settime(my->timerid, 0, &disable, NULL);
constexpr int64_t count() const
constexpr const microseconds & time_since_epoch() const
static constexpr time_point maximum()
Defines exception's used by fc.
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
void compute_and_print_timer_accuracy(platform_timer &t)
@ self
the connection is to itself