pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:3226:    *! @[broadcast()] wakes up all threads currently waiting for this condition.    *!    *! @seealso    *! @[signal()]    */   void f_cond_broadcast(INT32 UNUSED(args))   {    co_broadcast(&(THIS_COND->cond));   }    +  + static void f_cond__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_COND->mutex_obj) { +  push_static_text("Thread.Condition(/* %O */)"); +  ref_push_object(THIS_COND->mutex_obj); +  f_sprintf(2); +  } else { +  push_text("Thread.Condition(/* Unassociated */)"); +  } + } +    void init_cond_obj(struct object *UNUSED(o))   {    co_init(&(THIS_COND->cond));    THIS_COND->wait_count = 0;   }      void exit_cond_obj(struct object *UNUSED(o))   {    /* Wake up any threads that might be waiting on this cond.    *
pike.git/src/threads.c:4011:    tObjIs_THREAD_MUTEX, T_OBJECT, ID_PROTECTED|ID_PRIVATE);    ADD_FUNCTION("create", f_cond_create,    tFunc(tOr(tObjIs_THREAD_MUTEX, tVoid), tVoid),    ID_PROTECTED);    ADD_FUNCTION("wait",f_cond_wait,    tOr(tFunc(tObjIs_THREAD_MUTEX_KEY tOr3(tVoid, tIntPos, tFloat),    tVoid),    tFunc(tObjIs_THREAD_MUTEX_KEY tIntPos tIntPos, tVoid)),0);    ADD_FUNCTION("signal",f_cond_signal,tFunc(tNone,tVoid),0);    ADD_FUNCTION("broadcast",f_cond_broadcast,tFunc(tNone,tVoid),0); +  ADD_FUNCTION("_sprintf", f_cond__sprintf, +  tFunc(tOr(tInt, tVoid), tStr), ID_PROTECTED);    set_init_callback(init_cond_obj);    set_exit_callback(exit_cond_obj);    condition_program = Pike_compiler->new_program;    add_ref(condition_program);    end_class("condition", 0);       {    struct program *tmp;    START_NEW_PROGRAM_ID(THREAD_DISABLE_THREADS);    set_init_callback(init_threads_disable);