From: agiersch Date: Tue, 23 Nov 2010 20:01:16 +0000 (+0000) Subject: Synchronize threads before exit on armageddon. X-Git-Tag: v3_5~207 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/dc6775d4c4eb81fee210853dd09bf97527671dbc?hp=e88ddfbe862c7c5e5fffb64d9cfd64fa147fdffd 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 --- 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); }