Sha256: f94c73535ebf323f3f72c2e5e02d543210f8fc16dfd4dd81a57f83608f7e6f7c
Contents?: true
Size: 408 Bytes
Versions: 39
Compression:
Stored size: 408 Bytes
Contents
#include <signal.h> #include <time.h> typedef void (*callback)(union sigval); timer_t posix_timer(callback cb, void* data) { timer_t id; struct sigevent sev = { .sigev_notify = SIGEV_THREAD, .sigev_notify_function = cb, }; sev.sigev_value.sival_ptr = data; if (timer_create(CLOCK_REALTIME, &sev, &id) == -1) { return 0; } else { return id; } }
Version data entries
39 entries across 39 versions & 1 rubygems