mirror of
https://github.com/cesanta/mongoose.git
synced 2024-12-12 07:29:04 +08:00
commit
ec79ca71b2
@ -3494,8 +3494,10 @@ struct mg_connection *mg_wrapfd(struct mg_mgr *mgr, int fd,
|
|||||||
struct mg_timer *mg_timer_add(struct mg_mgr *mgr, uint64_t milliseconds,
|
struct mg_timer *mg_timer_add(struct mg_mgr *mgr, uint64_t milliseconds,
|
||||||
unsigned flags, void (*fn)(void *), void *arg) {
|
unsigned flags, void (*fn)(void *), void *arg) {
|
||||||
struct mg_timer *t = (struct mg_timer *) calloc(1, sizeof(*t));
|
struct mg_timer *t = (struct mg_timer *) calloc(1, sizeof(*t));
|
||||||
|
if (t != NULL) {
|
||||||
mg_timer_init(&mgr->timers, t, milliseconds, flags, fn, arg);
|
mg_timer_init(&mgr->timers, t, milliseconds, flags, fn, arg);
|
||||||
t->id = mgr->timerid++;
|
t->id = mgr->timerid++;
|
||||||
|
}
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,8 +224,10 @@ struct mg_connection *mg_wrapfd(struct mg_mgr *mgr, int fd,
|
|||||||
struct mg_timer *mg_timer_add(struct mg_mgr *mgr, uint64_t milliseconds,
|
struct mg_timer *mg_timer_add(struct mg_mgr *mgr, uint64_t milliseconds,
|
||||||
unsigned flags, void (*fn)(void *), void *arg) {
|
unsigned flags, void (*fn)(void *), void *arg) {
|
||||||
struct mg_timer *t = (struct mg_timer *) calloc(1, sizeof(*t));
|
struct mg_timer *t = (struct mg_timer *) calloc(1, sizeof(*t));
|
||||||
|
if (t != NULL) {
|
||||||
mg_timer_init(&mgr->timers, t, milliseconds, flags, fn, arg);
|
mg_timer_init(&mgr->timers, t, milliseconds, flags, fn, arg);
|
||||||
t->id = mgr->timerid++;
|
t->id = mgr->timerid++;
|
||||||
|
}
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user