MCPcopy Create free account
hub / github.com/acl-dev/acl / sync_timer_new

Function sync_timer_new

lib_fiber/c/src/sync/sync_timer.c:18–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16};
17
18static SYNC_TIMER *sync_timer_new(void)
19{
20 SYNC_TIMER *timer = (SYNC_TIMER*) mem_calloc(1, sizeof(SYNC_TIMER));
21 socket_t in, out;
22 FILE_EVENT *fe;
23
24 pthread_mutex_init(&timer->lock, NULL);
25 timer->box = mbox_create(MBOX_T_MPSC);
26// timer->waiters = timer_cache_create();
27 timer->tid = thread_self();
28
29 out = mbox_out(timer->box);
30 assert(out != INVALID_SOCKET);
31 fe = fiber_file_open(out);
32 assert(fe);
33 fe->type |= TYPE_INTERNAL | TYPE_EVENTABLE;
34
35 in = mbox_in(timer->box);
36 assert(in != INVALID_SOCKET);
37 if (in != out) {
38 fe = fiber_file_open(in);
39 assert(fe);
40 fe->type |= TYPE_INTERNAL | TYPE_EVENTABLE;
41 }
42
43 return timer;
44}
45
46static void sync_timer_free(SYNC_TIMER *timer)
47{

Callers 1

sync_timer_getFunction · 0.85

Calls 7

mem_callocFunction · 0.85
pthread_mutex_initFunction · 0.85
thread_selfFunction · 0.85
mbox_outFunction · 0.85
fiber_file_openFunction · 0.85
mbox_inFunction · 0.85
mbox_createFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…