Skip to content

Commit

Permalink
Fixes #522 - Clear the 'running' flag in the context of the core thre…
Browse files Browse the repository at this point in the history
…ad during shutdown.
  • Loading branch information
ted-ross committed May 31, 2022
1 parent 56a080f commit b47bccd
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/router_core/router_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,19 @@ qdr_core_t *qdr_core(qd_dispatch_t *qd, qd_router_mode_t mode, const char *area,
}


void qdr_core_stop_thread_CT(qdr_core_t *core, qdr_action_t *action, bool discard) {
if (!discard) {
core->running = false;
}
}


void qdr_core_free(qdr_core_t *core)
{
//
// Stop and join the thread
//
core->running = false;

sys_cond_signal(core->action_cond);
qdr_action_enqueue(core, qdr_action(qdr_core_stop_thread_CT, "Stop Thread"));
sys_thread_join(core->thread);

// have adaptors clean up all core resources
Expand Down

0 comments on commit b47bccd

Please sign in to comment.