| 209 | } |
| 210 | |
| 211 | long long aeCreateTimeEvent(aeEventLoop *eventLoop, long long milliseconds, |
| 212 | aeTimeProc *proc, void *clientData, |
| 213 | aeEventFinalizerProc *finalizerProc) |
| 214 | { |
| 215 | long long id = eventLoop->timeEventNextId++; |
| 216 | aeTimeEvent *te; |
| 217 | |
| 218 | te = zmalloc(sizeof(*te)); |
| 219 | if (te == NULL) return AE_ERR; |
| 220 | te->id = id; |
| 221 | te->when = getMonotonicUs() + milliseconds * 1000; |
| 222 | te->timeProc = proc; |
| 223 | te->finalizerProc = finalizerProc; |
| 224 | te->clientData = clientData; |
| 225 | te->prev = NULL; |
| 226 | te->next = eventLoop->timeEventHead; |
| 227 | te->refcount = 0; |
| 228 | if (te->next) |
| 229 | te->next->prev = te; |
| 230 | eventLoop->timeEventHead = te; |
| 231 | return id; |
| 232 | } |
| 233 | |
| 234 | int aeDeleteTimeEvent(aeEventLoop *eventLoop, long long id) |
| 235 | { |
no test coverage detected