Skip to content
Snippets Groups Projects
Commit 95be5a80 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Simplify the child thread wait loop in cleanup()

parent 6326f6d0
No related branches found
No related tags found
No related merge requests found
Pipeline #5796 passed
...@@ -6896,15 +6896,17 @@ void web_terminate(void) ...@@ -6896,15 +6896,17 @@ void web_terminate(void)
static void cleanup(int code) static void cleanup(int code)
{ {
if(protected_uint32_value(thread_count) > 1) { bool waited = false;
lprintf(LOG_INFO,"0000 Waiting for %d child threads to terminate", protected_uint32_value(thread_count)-1); uint32_t threads;
while(protected_uint32_value(thread_count) > 1) {
while((threads = protected_uint32_value(thread_count)) > 1) {
lprintf(LOG_INFO,"0000 Waiting for %d child threads to terminate", threads-1);
mswait(1000); mswait(1000);
waited = true;
listSemPost(&log_list); listSemPost(&log_list);
lprintf(LOG_INFO,"0000 Waiting for %d child threads to terminate", protected_uint32_value(thread_count)-1);
} }
if(waited)
lprintf(LOG_INFO,"0000 Done waiting"); lprintf(LOG_INFO,"0000 Done waiting");
}
terminate_js = false; terminate_js = false;
free_cfg(&scfg); free_cfg(&scfg);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment