pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:1:   #include "global.h" - RCSID("$Id: threads.c,v 1.171 2003/12/13 20:37:52 jonasw Exp $"); + RCSID("$Id: threads.c,v 1.172 2003/12/13 21:13:08 jonasw Exp $");      PMOD_EXPORT int num_threads = 1;   PMOD_EXPORT 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:509: Inside #if 0
   mt_unlock( & thread_table_lock );   #if 0    if(num_threads>1 && s)    dumpmem("thread_state_for_id return value: ",&s->id,sizeof(tid));   #endif    return s;    /* NOTEZ BIEN: Return value only guaranteed to remain valid as long    as you have the interpreter lock, unless tid == th_self() */   }    - struct thread_state *gdb_thread_state_for_id(THREAD_T tid) - /* Should only be used from a debugger session. */ - { -  unsigned INT32 h = thread_table_hash(&tid); -  struct thread_state *s; -  for (s = thread_table_chains[h]; s != NULL; s = s->hashlink) -  if(th_equal(s->id, tid)) -  break; -  return s; - } -  - INT32 gdb_next_thread_state(INT32 prev, struct thread_state **ts) - /* Used by gdb_backtraces. */ - { -  if (!*ts || !(*ts)->hashlink) { -  if (!*ts) prev = -1; -  while (++prev < THREAD_TABLE_SIZE) -  if ((*ts = thread_table_chains[prev])) -  return prev; -  *ts = NULL; -  return 0; -  } -  *ts = (*ts)->hashlink; -  return prev; - } -  +    PMOD_EXPORT struct object *thread_for_id(THREAD_T tid)   {    struct thread_state *s = thread_state_for_id(tid);    return (s == NULL? NULL : THREADSTATE2OBJ(s));    /* See NB in thread_state_for_id. Lifespan of result can be prolonged    by incrementing refcount though. */   }         PMOD_EXPORT void f_all_threads(INT32 args)
pike.git/src/threads.c:1247:    gc_recurse_mapping(tmp->thread_local);   }      static void thread_was_checked(struct object *o)   {    struct thread_state *tmp=THIS_THREAD;    if(tmp->thread_local != NULL)    debug_gc_check(tmp->thread_local, T_OBJECT, o);      #ifdef PIKE_DEBUG - #if 0 -  if (tmp->swapped != 0 && tmp->swapped != 1) { -  fprintf(stderr, -  "tmp->swapped: %d, id: %d, tmp: %x, thread_id_prog: %x\n", -  tmp->swapped, tmp->id, tmp, thread_id_prog); -  } - #endif +     if(tmp->swapped)    {    struct pike_frame *f;    debug_malloc_touch(o);    debug_gc_xmark_svalues(tmp->state.evaluator_stack,    tmp->state.stack_pointer-tmp->state.evaluator_stack-1,    " in idle thread stack");       for(f=tmp->state.frame_pointer;f;f=f->next)    {