pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:1:   #include "global.h" - RCSID("$Id: threads.c,v 1.41 1997/09/17 13:04:14 hubbe Exp $"); + RCSID("$Id: threads.c,v 1.42 1997/09/22 01:01:19 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:198:    (unsigned int)m,    (unsigned int)OB2KEY(m->key)->mut,    (unsigned int) thread_id));    free_object(o);    error("Recursive mutex locks!\n");    }    }       if(m->key)    { -  destruct_objects_to_destruct(); -  if(m->key) -  { +     SWAP_OUT_CURRENT_THREAD();    do    {    THREADS_FPRINTF((stderr,"WAITING TO LOCK m:%08x\n",(unsigned int)m));    co_wait(& m->condition, & interpreter_lock);    }while(m->key);    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);
pike.git/src/threads.c:243:    */       if(!args || IS_ZERO(sp-args))    {    if(m->key && OB2KEY(m->key)->owner == thread_id)    {    free_object(o);    error("Recursive mutex locks!\n");    }    } -  if(m->key) -  destruct_objects_to_destruct(); +        if(!m->key)    {    OB2KEY(o)->mut=m;    m->key=o;    i=1;    }       pop_n_elems(args);    if(i)
pike.git/src/threads.c:448:    start_new_program();    mutex_key_offset = add_storage(sizeof(struct key_storage));    /* This is needed to allow the gc to find the possible circular reference.    * It also allows a process to take over ownership of a key.    */    map_variable("_owner", "object", 0,    mutex_key_offset + OFFSETOF(key_storage, owner), T_OBJECT);    set_init_callback(init_mutex_key_obj);    set_exit_callback(exit_mutex_key_obj);    mutex_key=end_program(); +  mutex_key->flags|=PROG_DESTRUCT_IMMEDIATE;    if(!mutex_key)    fatal("Failed to initialize mutex_key program!\n");       start_new_program();    add_storage(sizeof(COND_T));    add_function("wait",f_cond_wait,"function(void|object:void)",0);    add_function("signal",f_cond_signal,"function(:void)",0);    add_function("broadcast",f_cond_broadcast,"function(:void)",0);    set_init_callback(init_cond_obj);    set_exit_callback(exit_cond_obj);