pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:1:   #include "global.h" - RCSID("$Id: threads.c,v 1.37 1997/09/08 19:58:42 hubbe Exp $"); + RCSID("$Id: threads.c,v 1.38 1997/09/08 21:32:37 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:174:    int initialized;   };      #define OB2KEY(X) ((struct key_storage *)((X)->storage))      void f_mutex_lock(INT32 args)   {    struct mutex_storage *m;    struct object *o;    -  pop_n_elems(args); +     m=THIS_MUTEX;    /* Needs to be cloned here, since create()    * might use threads.    */    o=clone_object(mutex_key,0);    if(!args || IS_ZERO(sp-args))    {    if(m->key && OB2KEY(m->key)->owner == thread_id)    {    THREADS_FPRINTF((stderr, "Recursive LOCK k:%08x, m:%08x(%08x), t:%08x\n",
pike.git/src/threads.c:209:    }    SWAP_IN_CURRENT_THREAD();    m->key=o;    OB2KEY(o)->mut=m;       THREADS_FPRINTF((stderr, "LOCK k:%08x, m:%08x(%08x), t:%08x\n",    (unsigned int)OB2KEY(o),    (unsigned int)m,    (unsigned int)OB2KEY(m->key)->mut,    (unsigned int)thread_id)); +  pop_n_elems(args);    push_object(o);   }      void f_mutex_trylock(INT32 args)   {    struct mutex_storage *m;    struct object *o;    int i=0; -  pop_n_elems(args); +        o=clone_object(mutex_key,0);    m=THIS_MUTEX;       /* No reason to release the interpreter lock here    * since we aren't calling any functions that take time.    */       if(!args || IS_ZERO(sp-args))    {
pike.git/src/threads.c:241:    error("Recursive mutex locks!\n");    }    }    if(!m->key)    {    OB2KEY(o)->mut=m;    m->key=o;    i=1;    }    +  pop_n_elems(args);    if(i)    {    push_object(o);    } else {    destruct(o);    free_object(o);    push_int(0);    }   }