From dc6775d4c4eb81fee210853dd09bf97527671dbc Mon Sep 17 00:00:00 2001 From: agiersch Date: Tue, 23 Nov 2010 20:01:16 +0000 Subject: [PATCH] Synchronize threads before exit on armageddon. This fixes a segfault when a runner thread tries to use the logging facility after it has been shut down. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8623 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- tools/tesh/run_context.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/tesh/run_context.c b/tools/tesh/run_context.c index e809ebe792..dc19f3f147 100644 --- a/tools/tesh/run_context.c +++ b/tools/tesh/run_context.c @@ -180,6 +180,13 @@ void rctx_armageddon(rctx_t initiator, int exitcode) rctx_armageddon_kill_one(initiator, filepos, job); } + /* Give runner threads a chance to acknowledge the processes deaths */ + usleep(10000); + /* Ensure that nobody is running rctx_wait on exit */ + if (fg_job) + xbt_os_mutex_acquire(rctx->interruption); + xbt_dynar_foreach(bg_jobs, cursor, job) + xbt_os_mutex_acquire(job->interruption); VERB0("Shut everything down!"); exit(exitcode); } -- 2.20.1