| 26 | using namespace dmtcp; |
| 27 | |
| 28 | extern "C" int |
| 29 | timer_create(clockid_t clockid, struct sigevent *sevp, timer_t *timerid) |
| 30 | { |
| 31 | struct sigevent sevOut; |
| 32 | timer_t realId; |
| 33 | timer_t virtId; |
| 34 | int ret; |
| 35 | |
| 36 | DMTCP_PLUGIN_DISABLE_CKPT(); |
| 37 | |
| 38 | // Note that clockid can be for a system-wide clock with no virtual id. |
| 39 | // An example is CLOCK_REALTIME. By luck, VIRTUAL_TO_REAL_CLOCK_ID() |
| 40 | // return its argument if no virtual id is found. |
| 41 | // See: virtualidtable.h: dmtcp::VirtualIdTable::virtualToReal(...) |
| 42 | clockid_t realClockId = VIRTUAL_TO_REAL_CLOCK_ID(clockid); |
| 43 | if (sevp != NULL && sevp->sigev_notify == SIGEV_THREAD) { |
| 44 | ret = timer_create_sigev_thread(realClockId, sevp, &realId, &sevOut); |
| 45 | sevp = &sevOut; |
| 46 | } else { |
| 47 | ret = _real_timer_create(realClockId, sevp, &realId); |
| 48 | } |
| 49 | if (ret != -1 && timerid != NULL) { |
| 50 | virtId = TimerList::instance().on_timer_create(realId, clockid, sevp); |
| 51 | JTRACE("Creating new timer") (clockid) (realClockId) (realId) (virtId); |
| 52 | *timerid = virtId; |
| 53 | } |
| 54 | DMTCP_PLUGIN_ENABLE_CKPT(); |
| 55 | return ret; |
| 56 | } |
| 57 | |
| 58 | extern "C" int |
| 59 | timer_delete(timer_t timerid) |
no test coverage detected