diff options
author | Rickard Green <[email protected]> | 2015-06-10 18:07:33 +0200 |
---|---|---|
committer | Rickard Green <[email protected]> | 2015-06-10 18:07:33 +0200 |
commit | c8825f09f5df654ab89d417af827bfaa7f185066 (patch) | |
tree | d9255a7a58e01421f3571f4cd9074b557e8d3567 /erts/emulator/beam/time.c | |
parent | d395b5c5559a18e44258ca46e4b8703189d18067 (diff) | |
parent | ea84ab6c03994f8d6d9f07d8740f0547f8a3cb51 (diff) | |
download | otp-c8825f09f5df654ab89d417af827bfaa7f185066.tar.gz otp-c8825f09f5df654ab89d417af827bfaa7f185066.tar.bz2 otp-c8825f09f5df654ab89d417af827bfaa7f185066.zip |
Merge branch 'rickard/timer-improvement/OTP-12650'
* rickard/timer-improvement/OTP-12650:
Callback timer
Disable accessor timer option
Aux work flag descriptions
Fix test cases
Diffstat (limited to 'erts/emulator/beam/time.c')
-rw-r--r-- | erts/emulator/beam/time.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/erts/emulator/beam/time.c b/erts/emulator/beam/time.c index 8bffdedb2b..fe7c5826f5 100644 --- a/erts/emulator/beam/time.c +++ b/erts/emulator/beam/time.c @@ -529,6 +529,9 @@ erts_create_timer_wheel(ErtsSchedulerData *esdp) tiw->next_timeout_time = mtime + ERTS_MONOTONIC_DAY; tiw->sentinel.next = &tiw->sentinel; tiw->sentinel.prev = &tiw->sentinel; + tiw->sentinel.u.func.timeout = NULL; + tiw->sentinel.u.func.cancel = NULL; + tiw->sentinel.u.func.arg = NULL; return tiw; } @@ -624,6 +627,41 @@ erts_twheel_cancel_timer(ErtsTimerWheel *tiw, ErtsTWheelTimer *p) } } +void +erts_twheel_debug_foreach(ErtsTimerWheel *tiw, + void (*tclbk)(void *), + void (*func)(void *, + ErtsMonotonicTime, + void *), + void *arg) +{ + ErtsTWheelTimer *tmr; + int ix; + + tmr = tiw->sentinel.next; + while (tmr != &tiw->sentinel) { + if (tmr->u.func.timeout == tclbk) + (*func)(arg, tmr->timeout_pos, tmr->u.func.arg); + tmr = tmr->next; + } + + for (tmr = tiw->at_once.head; tmr; tmr = tmr->next) { + if (tmr->u.func.timeout == tclbk) + (*func)(arg, tmr->timeout_pos, tmr->u.func.arg); + } + + for (ix = 0; ix < ERTS_TIW_SIZE; ix++) { + tmr = tiw->w[ix]; + if (tmr) { + do { + if (tmr->u.func.timeout == tclbk) + (*func)(arg, tmr->timeout_pos, tmr->u.func.arg); + tmr = tmr->next; + } while (tmr != tiw->w[ix]); + } + } +} + #ifdef ERTS_TW_DEBUG void erts_p_slpq(void) { |