pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:1:   #include "global.h" - RCSID("$Id: threads.c,v 1.78 1998/07/17 13:28:25 grubba Exp $"); + RCSID("$Id: threads.c,v 1.79 1998/07/17 22:37:11 hubbe Exp $");      int num_threads = 1;   int threads_disabled = 0;      #ifdef _REENTRANT   #include "threads.h"   #include "array.h"   #include "object.h"   #include "pike_macros.h"   #include "callback.h"
pike.git/src/threads.c:319:      unsigned INT32 thread_table_hash(THREAD_T *tid)   {    return th_hash(*tid) % THREAD_TABLE_SIZE;   }      void thread_table_insert(struct object *o)   {    struct thread_state *s = (struct thread_state *)o->storage;    unsigned INT32 h = thread_table_hash(&s->id); + #ifdef DEBUG +  if(h>=THREAD_TABLE_SIZE) +  fatal("thread_table_hash failed miserably!\n"); + #endif    mt_lock( & thread_table_lock );    if((s->hashlink = thread_table_chains[h]) != NULL)    s->hashlink->backlink = &s->hashlink;    thread_table_chains[h] = s;    s->backlink = &thread_table_chains[h];    mt_unlock( & thread_table_lock );   }      void thread_table_delete(struct object *o)   {
pike.git/src/threads.c:341:    if(s->hashlink != NULL)    s->hashlink->backlink = s->backlink;    *(s->backlink) = s->hashlink;    mt_unlock( & thread_table_lock );   }      struct thread_state *thread_state_for_id(THREAD_T tid)   {    unsigned INT32 h = thread_table_hash(&tid);    struct thread_state *s = NULL; + #ifdef DEBUG +  if(h>=THREAD_TABLE_SIZE) +  fatal("thread_table_hash failed miserably!\n"); + #endif    mt_lock( & thread_table_lock );    if(thread_table_chains[h] == NULL)    {    /* NULL result */    }    else if(th_equal((s=thread_table_chains[h])->id, tid))    {    /* Quick return */    }    else