pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:1:   #include "global.h" - RCSID("$Id: threads.c,v 1.120 2000/04/18 06:53:48 jonasw Exp $"); + RCSID("$Id: threads.c,v 1.121 2000/04/19 13:57:36 mast 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:193:      #endif         #define THIS_THREAD ((struct thread_state *)CURRENT_STORAGE)      struct object *thread_id = NULL;   static struct callback *threads_evaluator_callback=0;   int thread_id_result_variable;    + int th_running = 0;   MUTEX_T interpreter_lock, thread_table_lock, interleave_lock;   struct program *mutex_key = 0;   struct program *thread_id_prog = 0;   struct program *thread_local_prog = 0;   #ifdef POSIX_THREADS   pthread_attr_t pattr;   pthread_attr_t small_pattr;   #endif   int thread_storage_offset;   
pike.git/src/threads.c:1177: Inside #if defined(POSIX_THREADS)
   pthread_attr_setstacksize(&pattr, thread_stack_size);   #endif    pthread_attr_setdetachstate(&pattr, PTHREAD_CREATE_DETACHED);       pthread_attr_init(&small_pattr);   #ifdef HAVE_PTHREAD_ATTR_SETSTACKSIZE    pthread_attr_setstacksize(&small_pattr, 4096*sizeof(char *));   #endif    pthread_attr_setdetachstate(&small_pattr, PTHREAD_CREATE_DETACHED);    +  th_running = 1;   #endif   }      void th_init(void)   {    struct program *tmp;    INT32 mutex_key_offset;      #ifdef UNIX_THREADS   
pike.git/src/threads.c:1314:       thread_id=clone_object(thread_id_prog,0);    SWAP_OUT_THREAD(OBJ2THREAD(thread_id)); /* Init struct */    OBJ2THREAD(thread_id)->swapped=0;    OBJ2THREAD(thread_id)->id=th_self();    thread_table_insert(thread_id);   }      void th_cleanup(void)   { +  th_running = 0; +     if(thread_id)    {    thread_table_delete(thread_id);    destruct(thread_id);    free_object(thread_id);    thread_id=0;    }       if(mutex_key)    {