pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:1:   #include "global.h" - RCSID("$Id: threads.c,v 1.145 2000/11/20 01:20:26 mast Exp $"); + RCSID("$Id: threads.c,v 1.146 2000/12/01 01:15:02 hubbe 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:201:   int thread_id_result_variable;      int th_running = 0;   #ifdef PIKE_DEBUG   int debug_interpreter_is_locked = 0;   THREAD_T debug_locking_thread;   #endif   PMOD_EXPORT MUTEX_T interpreter_lock;   MUTEX_T thread_table_lock, interleave_lock;   struct program *mutex_key = 0; - struct program *thread_id_prog = 0; + PMOD_EXPORT 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   PMOD_EXPORT ptrdiff_t thread_storage_offset;      struct thread_starter   {    struct object *id;
pike.git/src/threads.c:407: Inside #if defined(PIKE_DEBUG)
   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       - void thread_table_insert(struct object *o) + PMOD_EXPORT void thread_table_insert(struct object *o)   {    struct thread_state *s = OBJ2THREAD(o);    unsigned INT32 h = thread_table_hash(&s->id);   #ifdef PIKE_DEBUG    if(h>=THREAD_TABLE_SIZE)    fatal("thread_table_hash failed miserably!\n");    if(thread_state_for_id(s->id))    {    if(thread_state_for_id(s->id) == s)    fatal("Registring thread twice!\n");
pike.git/src/threads.c:432:   #endif    mt_lock( & thread_table_lock );    num_pike_threads++;    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) + PMOD_EXPORT void thread_table_delete(struct object *o)   {    struct thread_state *s = OBJ2THREAD(o);   /* dumpmem("thread_table_delete",&s->id, sizeof(THREAD_T)); */    mt_lock( & thread_table_lock );    num_pike_threads--;    if(s->hashlink != NULL)    s->hashlink->backlink = s->backlink;    *(s->backlink) = s->hashlink;    mt_unlock( & thread_table_lock );   }
pike.git/src/threads.c:727: Inside #if defined(UNIX_THREADS)
  {    int c=1;    if(args) c=Pike_sp[-args].u.integer;    else error("No argument to thread_set_concurrency(int concurrency);\n");    pop_n_elems(args);    num_lwps=c;    th_setconcurrency(c);   }   #endif    - void f_this_thread(INT32 args) + PMOD_EXPORT void f_this_thread(INT32 args)   {    pop_n_elems(args);    ref_push_object(Pike_interpreter.thread_id);   }      #define THIS_MUTEX ((struct mutex_storage *)(CURRENT_STORAGE))         /* Note:    * No reference is kept to the key object, it is destructed if the
pike.git/src/threads.c:1117: Inside #if defined(PIKE_DEBUG)
   debug_malloc_touch(f);    if(f->context.parent)    gc_external_mark2(f->context.parent,0," in Pike_fp->context.parent of idle thread");    gc_external_mark2(f->current_object,0," in Pike_fp->current_object of idle thread");    gc_external_mark2(f->context.prog,0," in Pike_fp->context.prog of idle thread");    }    }   #endif   }    - void f_thread_local(INT32 args) + PMOD_EXPORT void f_thread_local(INT32 args)   {    static INT32 thread_local_id = 0;       struct object *loc = clone_object(thread_local_prog,0);    ((struct thread_local *)loc->storage)->id = thread_local_id++;    pop_n_elems(args);    push_object(loc);   }      void f_thread_local_get(INT32 args)