pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:1:   #include "global.h" - RCSID("$Id: threads.c,v 1.120 2001/10/22 23:54:43 mast Exp $"); + RCSID("$Id: threads.c,v 1.121 2003/03/31 18:43:59 grubba Exp $");      int num_threads = 1;   int threads_disabled = 0;      #ifdef _REENTRANT   #include "threads.h"   #include "array.h"   #include "mapping.h"   #include "object.h"   #include "pike_macros.h"
pike.git/src/threads.c:571:    THREADS_FPRINTF(1, (stderr,    "new_thread_func(): Threads disabled\n"));    co_wait(&threads_disabled_change, &interpreter_lock);    }       init_interpreter();    thread_id=arg.id;    stack_top=((char *)&data)+ (thread_stack_size-16384) * STACK_DIRECTION;    recoveries = NULL;    SWAP_OUT_THREAD(OBJ2THREAD(thread_id)); /* Init struct */ +  thread_id=arg.id;    OBJ2THREAD(thread_id)->swapped=0;      #if defined(PIKE_DEBUG)    if(d_flag)    {    THREAD_T self = th_self();       if( thread_id && !th_equal( OBJ2THREAD(thread_id)->id, self) )    fatal("Current thread is wrong. %x %x\n",    OBJ2THREAD(thread_id)->id, self);
pike.git/src/threads.c:1411:    OPT_EXTERNAL_DEPEND);       /* Some constants... */    add_integer_constant("THREAD_NOT_STARTED", THREAD_NOT_STARTED, 0);    add_integer_constant("THREAD_RUNNING", THREAD_RUNNING, 0);    add_integer_constant("THREAD_EXITED", THREAD_EXITED, 0);       if(!mutex_key)    fatal("Failed to initialize thread program!\n");    -  thread_id=clone_object(thread_id_prog,0); +  { +  struct object *o = thread_id = clone_object(thread_id_prog,0);    SWAP_OUT_THREAD(OBJ2THREAD(thread_id)); /* Init struct */ -  +  thread_id = o; +  }    OBJ2THREAD(thread_id)->swapped=0;    OBJ2THREAD(thread_id)->id=th_self();    thread_table_insert(thread_id);   }      void th_cleanup(void)   {    if(thread_id)    {    thread_table_delete(thread_id);