diff options
author | Rickard Green <[email protected]> | 2019-07-22 11:36:49 +0200 |
---|---|---|
committer | Rickard Green <[email protected]> | 2019-07-22 11:36:49 +0200 |
commit | bcffb7f5599efb62f13128e6feeb03a65cd9c11e (patch) | |
tree | 727817f9c55bedc98ab8d8bb71df5262a244a308 /erts/emulator/beam/erl_process.c | |
parent | 993139cdbe67523027aa69ec8542d32dd99d4b77 (diff) | |
parent | bf72b2e9f1239337764955bd633af46149b6c3d6 (diff) | |
download | otp-bcffb7f5599efb62f13128e6feeb03a65cd9c11e.tar.gz otp-bcffb7f5599efb62f13128e6feeb03a65cd9c11e.tar.bz2 otp-bcffb7f5599efb62f13128e6feeb03a65cd9c11e.zip |
Merge branch 'rickard/node-refc-tests-22' into maint
* rickard/node-refc-tests-22:
Fix etp-ets-tables
Fix node refc test for free processes hanging around
Enhanced node refc bookkeeping
Fix node container refc tests of ETS
Fix node refc test of external data
Node container refc test for persistent terms
Include persistent term storage in node/dist refc check
Fix node refc test for system message queue
Diffstat (limited to 'erts/emulator/beam/erl_process.c')
-rw-r--r-- | erts/emulator/beam/erl_process.c | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c index de0564292d..1c1ef1db84 100644 --- a/erts/emulator/beam/erl_process.c +++ b/erts/emulator/beam/erl_process.c @@ -13468,3 +13468,79 @@ erts_debug_later_op_foreach(void (*callback)(void*), } } } + +void +erts_debug_free_process_foreach(void (*func)(Process *, void *), void *arg) +{ + ErtsRunQueue *rq; + int ix, prio; + for (ix = 0; ix < erts_no_run_queues; ix++) { + rq = ERTS_RUNQ_IX(ix); + for (prio = PRIORITY_MAX; prio < PRIORITY_LOW; prio++) { + Process *p = rq->procs.prio[prio].first; + for (; p; p = p->next) { + if (ERTS_PSFLG_FREE & erts_atomic32_read_nob(&p->state)) + (*func)(p, arg); + } + } + } +} + +void +erts_debug_proc_monitor_link_foreach(Process *proc, + int (*monitor_func)(ErtsMonitor *, void *, Sint ), + int (*link_func)(ErtsLink *, void *, Sint ), + void *arg) +{ + if (!(erts_atomic32_read_nob(&proc->state) & ERTS_PSFLG_FREE)) { + /* For all links */ + erts_link_tree_foreach(ERTS_P_LINKS(proc), + link_func, + arg); + /* For all monitors */ + erts_monitor_tree_foreach(ERTS_P_MONITORS(proc), + monitor_func, + arg); + /* For all local target monitors */ + erts_monitor_list_foreach(ERTS_P_LT_MONITORS(proc), + monitor_func, + arg); + } + else { + struct continue_exit_state *ce_state = proc->u.terminate; + + /* For all links */ + if (ce_state->phase == ERTS_CONTINUE_EXIT_LINKS) + erts_debug_link_tree_destroying_foreach(ce_state->links, + link_func, + arg, + ce_state->yield_state); + else + erts_link_tree_foreach(ce_state->links, + link_func, + arg); + + /* For all monitors */ + if (ce_state->phase == ERTS_CONTINUE_EXIT_MONITORS) + erts_debug_monitor_tree_destroying_foreach(ce_state->monitors, + monitor_func, + arg, + ce_state->yield_state); + else + erts_monitor_tree_foreach(ce_state->monitors, + monitor_func, + arg); + + /* For all local target monitors */ + if (ce_state->phase == ERTS_CONTINUE_EXIT_LT_MONITORS) + erts_debug_monitor_list_destroying_foreach(ce_state->lt_monitors, + monitor_func, + arg, + ce_state->yield_state); + else + erts_monitor_list_foreach(ce_state->lt_monitors, + monitor_func, + arg); + + } +} |