pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:1:   /*   || 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.222 2003/10/06 13:01:37 mast Exp $ + || $Id: threads.c,v 1.223 2003/10/19 13:47:42 mast Exp $   */      #ifndef CONFIGURE_TEST   #include "global.h" - RCSID("$Id: threads.c,v 1.222 2003/10/06 13:01:37 mast Exp $"); + RCSID("$Id: threads.c,v 1.223 2003/10/19 13:47:42 mast Exp $");      PMOD_EXPORT int num_threads = 1;   PMOD_EXPORT int threads_disabled = 0;   #endif /* !CONFIGURE_TEST */      #ifdef _REENTRANT      #ifndef CONFIGURE_TEST      #include "threads.h"
pike.git/src/threads.c:256:   PMOD_EXPORT MUTEX_T interpreter_lock;   MUTEX_T thread_table_lock, interleave_lock;   struct program *mutex_key = 0;   PMOD_EXPORT struct program *thread_id_prog = 0;   struct program *thread_local_prog = 0;   PMOD_EXPORT ptrdiff_t thread_storage_offset;   #ifdef USE_CLOCK_FOR_SLICES   PMOD_EXPORT clock_t thread_start_clock = 0;   #endif    + #ifdef PIKE_DEBUG + PMOD_EXPORT const char msg_ip_not_locked[] = +  "Interpreter not locked.\n"; + PMOD_EXPORT const char msg_ip_not_locked_this_thr[] = +  "Interpreter not locked by this thread.\n"; + PMOD_EXPORT const char msg_thr_swapped_over[] = +  "Thread %08x swapped in over existing thread %08x.\n"; + PMOD_EXPORT const char msg_saved_thread_id[] = +  "Saved thread id: "; + PMOD_EXPORT const char msg_swap_in_cur_thr_failed[] = +  "SWAP_IN_CURRENT_THREAD failed.\n"; + PMOD_EXPORT const char msg_thr_not_swapped_in[] = +  "Thread is not swapped in.\n"; + PMOD_EXPORT const char msg_cur_thr_not_bound[] = +  "Current thread is not bound to the interpreter. " +  "Nested use of ALLOW_THREADS()?\n"; + PMOD_EXPORT const char msg_thr_states_mixed[] = +  "Thread states mixed up between threads.\n"; + PMOD_EXPORT const char msg_thr_allow_in_gc[] = +  "Threads allowed during garbage collection (pass %d).\n"; + PMOD_EXPORT const char msg_thr_allow_in_disabled[] = +  "Threads allowed from a different thread " +  "while threads are disabled.\n"; + #endif +    struct thread_local   {    INT32 id;   };      static volatile IMUTEX_T *interleave_list = NULL;      /* This is a variant of init_threads_disable that blocks all other    * threads that might run pike code, but still doesn't block the    * THREADS_ALLOW_UID threads. */
pike.git/src/threads.c:463:    for(x=0; x<THREAD_TABLE_SIZE; x++)    thread_table_chains[x] = NULL;   }      unsigned INT32 thread_table_hash(THREAD_T *tid)   {    return th_hash(*tid) % THREAD_TABLE_SIZE;   }      #ifdef PIKE_DEBUG - void dumpmem(char *desc, void *x, int size) + void dumpmem(const char *desc, void *x, int size)   {    int e;    unsigned char *tmp=(unsigned char *)x;    fprintf(stderr,"%s: ",desc);    for(e=0;e<size;e++)    fprintf(stderr,"%02x",tmp[e]);    fprintf(stderr,"\n");   }   #endif   
pike.git/src/threads.c:633: Inside #if defined(PIKE_DEBUG)
     #ifdef PIKE_DEBUG   void debug_list_all_threads(void)   {    INT32 x;    struct thread_state *s;    THREAD_T self = th_self();       fprintf(stderr,"--Listing all threads--\n");    dumpmem("Current thread: ",&self, sizeof(self)); -  fprintf(stderr,"Current thread state: %p\n",Pike_interpreter.thread_state); +  fprintf(stderr,"Current interpreter thread state: %p\n",Pike_interpreter.thread_state); +  fprintf(stderr,"Current thread state according to thread_state_for_id(): %p\n", +  thread_state_for_id (self));    fprintf(stderr,"Current thread obj: %p\n",    Pike_interpreter.thread_state?    Pike_interpreter.thread_state->thread_obj:NULL);    fprintf(stderr,"Current thread hash: %d\n",thread_table_hash(&self));    fprintf(stderr,"Current stack pointer: %p\n",&self);    for(x=0; x<THREAD_TABLE_SIZE; x++)    {    for(s=thread_table_chains[x]; s; s=s->hashlink) {    struct object *o = THREADSTATE2OBJ(s);    fprintf(stderr,"ThTab[%d]: %p (stackbase=%p)",x,o,s->state.stack_top);