pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:1:   #include "global.h" - RCSID("$Id: threads.c,v 1.18 1997/03/01 01:41:06 hubbe Exp $"); + RCSID("$Id: threads.c,v 1.19 1997/03/12 12:15:29 hubbe 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"
pike.git/src/threads.c:92:   int num_lwps = 1;   #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); +  arg->id=clone_object(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,
pike.git/src/threads.c:168:      #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; -  o=clone(mutex_key,0); +  o=clone_object(mutex_key,0);    mt_lock(& mutex_kluge);    THREADS_ALLOW();    while(m->key) co_wait(& m->condition, & mutex_kluge);    OB2KEY(o)->mut=m;    m->key=o;    mt_unlock(&mutex_kluge);    THREADS_DISALLOW();    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(mutex_key,0); +  o=clone_object(mutex_key,0);    m=THIS_MUTEX;    mt_lock(& mutex_kluge);    THREADS_ALLOW();    if(!m->key)    {    OB2KEY(o)->mut=THIS_MUTEX;    m->key=o;    i=1;    }    mt_unlock(&mutex_kluge);
pike.git/src/threads.c:358:    add_function("broadcast",f_cond_broadcast,"function(:void)",0);    set_init_callback(init_cond_obj);    set_exit_callback(exit_cond_obj);    end_class("condition", 0);       start_new_program();    thread_id_prog=end_program();    if(!mutex_key)    fatal("Failed to initialize thread program!\n");    -  thread_id=clone(thread_id_prog,0); +  thread_id=clone_object(thread_id_prog,0);   }      void th_cleanup()   {    if(mutex_key)    {    free_program(mutex_key);    mutex_key=0;    }