pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:1:   #include "global.h" - RCSID("$Id: threads.c,v 1.14 1997/01/26 22:49:14 per Exp $"); + RCSID("$Id: threads.c,v 1.15 1997/02/06 03:53:48 grubba Exp $");      int num_threads = 1;   int threads_disabled = 0;      #ifdef _REENTRANT   #include "threads.h"   #include "array.h"   #include "object.h"   #include "macros.h"   #include "callback.h"    -  +    struct object *thread_id;   static struct callback *threads_evaluator_callback=0;      MUTEX_T interpreter_lock = PTHREAD_MUTEX_INITIALIZER;   struct program *mutex_key = 0;   struct program *thread_id_prog = 0;   #ifdef POSIX_THREADS   pthread_attr_t pattr;   #endif   
pike.git/src/threads.c:92:   #endif      void f_thread_create(INT32 args)   {    THREAD_T dummy;    struct thread_starter *arg;    int tmp;    arg=ALLOC_STRUCT(thread_starter);    arg->args=aggregate_array(args);    arg->id=clone(thread_id_prog,0); +     tmp=th_create(&dummy,new_thread_func,arg); -  +     if(!tmp)    {    num_threads++;       if(num_threads == 1 && !threads_evaluator_callback)    {    threads_evaluator_callback=add_to_callback(&evaluator_callbacks,    check_threads, 0,0);    }   #ifdef UNIX_THREADS
pike.git/src/threads.c:135:      void f_this_thread(INT32 args)   {    pop_n_elems(args);    push_object(thread_id);    thread_id->refs++;   }      void th_init()   { + #ifdef SGI_SPROC_THREADS + #error /* Need to specify a filename */ +  us_cookie = usinit(""); + #endif /* SGI_SPROC_THREADS */    mt_lock( & interpreter_lock);   #ifdef POSIX_THREADS    pthread_attr_init(&pattr);   #ifdef HAVE_PTHREAD_ATTR_SETSTACKSIZE    pthread_attr_setstacksize(&pattr, 2 * 1024 * 1204);   #endif    pthread_attr_setdetachstate(&pattr, PTHREAD_CREATE_DETACHED);   #endif       add_efun("thread_create",f_thread_create,"function(mixed ...:object)",