Branch: Tag:

2009-09-29

2009-09-29 11:09:33 by Martin Stjernholm <mast@lysator.liu.se>

Reverted 1.256. This fixes a segfault if exit() is used from a thread
when cleanup-on-exit is compiled in.

Rev: src/threads.c:1.281

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: threads.c,v 1.280 2009/04/21 16:02:29 jonasw Exp $ + || $Id: threads.c,v 1.281 2009/09/29 11:09:33 mast Exp $   */      #include "global.h"
1095:    {    if(throw_severity <= THROW_ERROR)    call_handle_error(); +  if(throw_severity == THROW_EXIT) +  { +  /* This is too early to get a clean exit if DO_PIKE_CLEANUP is +  * active. Otoh it cannot be done later since it requires the +  * evaluator stacks in the gc calls. It's difficult to solve +  * without handing over the cleanup duty to the main thread. */ +  pike_do_exit(throw_value.u.integer); +  }    } else {    INT32 args=arg.args->size;    back.severity=THROW_EXIT;
1107:    if (thread_state->thread_obj)    assign_svalue(&thread_state->result, Pike_sp-1);    pop_stack(); -  -  throw_severity = THROW_N_A; +     }       UNSETJMP(back);
1162:    debug_print_rusage (stderr);   #endif    -  if (throw_severity == THROW_EXIT) -  /* Do this after all thread cleanup to avoid false alarms if using -  * DO_PIKE_CLEANUP. */ -  pike_do_exit (throw_value.u.integer); -  +     /* FIXME: What about threads_disable? */    mt_unlock_interpreter();    th_exit(0);