| 16 | }; |
| 17 | |
| 18 | static 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 | |
| 46 | static void sync_timer_free(SYNC_TIMER *timer) |
| 47 | { |
no test coverage detected
searching dependent graphs…