pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:2413:   #endif /* HAVE_NO_YIELD */    THREADS_DISALLOW();    }    }    else {    co_destroy(& m->condition);    }   #endif   }    - void exit_mutex_obj_compat_7_4(struct object *UNUSED(o)) - { -  struct mutex_storage *m = THIS_MUTEX; -  struct object *key = m->key; -  -  THREADS_FPRINTF(1, "DESTROYING MUTEX m:%p\n", THIS_MUTEX); -  -  if(key) { -  m->key=0; -  destruct(key); /* Will destroy m->condition if m->num_waiting is zero. */ -  } -  else { - #ifdef PIKE_DEBUG -  if (m->num_waiting) -  Pike_error ("key/num_waiting confusion.\n"); - #endif -  co_destroy(& m->condition); -  } - } -  +    /*! @endclass    */      /*! @class MutexKey    *!    *! Objects of this class are returned by @[Mutex()->lock()]    *! and @[Mutex()->trylock()]. They are also passed as arguments    *! to @[Condition()->wait()].    *!    *! As long as they are held, the corresponding mutex will be locked.
pike.git/src/threads.c:3357:    tFunc(tOr(tInt02,tVoid),tObjIs_THREAD_MUTEX_KEY),0);    ADD_FUNCTION("current_locking_thread",f_mutex_locking_thread,    tFunc(tNone,tObjIs_THREAD_ID), 0);    ADD_FUNCTION("current_locking_key",f_mutex_locking_key,    tFunc(tNone,tObjIs_THREAD_MUTEX_KEY), 0);    ADD_FUNCTION("_sprintf",f_mutex__sprintf,tFunc(tInt,tStr),0);    set_init_callback(init_mutex_obj);    set_exit_callback(exit_mutex_obj);    end_class("mutex", 0);    -  START_NEW_PROGRAM_ID(THREAD_MUTEX_COMPAT_7_4); -  ADD_STORAGE(struct mutex_storage); -  ADD_FUNCTION("lock",f_mutex_lock, -  tFunc(tOr(tInt02,tVoid),tObjIs_THREAD_MUTEX_KEY),0); -  ADD_FUNCTION("trylock",f_mutex_trylock, -  tFunc(tOr(tInt02,tVoid),tObjIs_THREAD_MUTEX_KEY),0); -  ADD_FUNCTION("current_locking_thread",f_mutex_locking_thread, -  tFunc(tNone,tObjIs_THREAD_ID), 0); -  ADD_FUNCTION("current_locking_key",f_mutex_locking_key, -  tFunc(tNone,tObjIs_THREAD_MUTEX_KEY), 0); -  set_init_callback(init_mutex_obj); -  set_exit_callback(exit_mutex_obj_compat_7_4); -  end_class("mutex_compat_7_4", 0); -  +     START_NEW_PROGRAM_ID(THREAD_CONDITION);    ADD_STORAGE(struct pike_cond);    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);    set_init_callback(init_cond_obj);    set_exit_callback(exit_cond_obj);