pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:2677:    THREADS_DISALLOW();    } else if (mutex_obj && !mutex_obj->prog) {    co_destroy (&mut->condition);    }       if (mutex_obj)    free_object(mutex_obj);    }   }    + static void f_mutex_key__sprintf(INT32 args) + { +  int c = 0; +  if(args>0 && TYPEOF(Pike_sp[-args]) == PIKE_T_INT) +  c = Pike_sp[-args].u.integer; +  pop_n_elems (args); +  if(c != 'O') { +  push_undefined(); +  return; +  } +  if (THIS_KEY->mutex_obj) { +  push_text("MutexKey(/* %O */)"); +  ref_push_object(THIS_KEY->mutex_obj); +  f_sprintf(2); +  } else { +  push_text("MutexKey()"); +  } + } +    /*! @endclass    */      /*! @class Condition    *!    *! Implementation of condition variables.    *!    *! Condition variables are used by threaded programs    *! to wait for events happening in other threads.    *!
pike.git/src/threads.c:3556:    START_NEW_PROGRAM_ID(THREAD_MUTEX_KEY);    mutex_key_offset = ADD_STORAGE(struct key_storage);    /* This is needed to allow the gc to find the possible circular reference.    * It also allows a thread to take over ownership of a key.    */    PIKE_MAP_VARIABLE("_owner",    mutex_key_offset + OFFSETOF(key_storage, owner_obj),    tObjIs_THREAD_ID, T_OBJECT, 0);    PIKE_MAP_VARIABLE("_mutex", mutex_key_offset + OFFSETOF(key_storage, mutex_obj),    tObjIs_THREAD_MUTEX, T_OBJECT, ID_PROTECTED|ID_PRIVATE); +  ADD_FUNCTION("_sprintf",f_mutex_key__sprintf,tFunc(tInt,tStr),ID_PROTECTED);    set_init_callback(init_mutex_key_obj);    set_exit_callback(exit_mutex_key_obj);    mutex_key=Pike_compiler->new_program;    add_ref(mutex_key);    end_class("mutex_key", 0);    mutex_key->flags|=PROGRAM_DESTRUCT_IMMEDIATE;       START_NEW_PROGRAM_ID(THREAD_MUTEX);    ADD_STORAGE(struct mutex_storage);    ADD_FUNCTION("lock",f_mutex_lock,