klisp

an open source interpreter for the Kernel Programming Language.
git clone http://git.hanabi.in/repos/klisp.git
Log | Files | Refs | README

kcondvar.h (766B)


      1 /*
      2 ** kcondvar.h
      3 ** Kernel Libraries
      4 ** See Copyright Notice in klisp.h
      5 */
      6 
      7 #ifndef kcondvar_h
      8 #define kcondvar_h
      9 
     10 #include "kobject.h"
     11 #include "kstate.h"
     12 
     13 TValue kmake_condvar(klisp_State *K, TValue mutex);
     14 void klispV_free(klisp_State *K, Condvar *condvar);
     15 
     16 /* LOCK: these functions require that the calling code has 
     17    acquired the GIL exactly once previous to the call and
     18    they may temporarily release it to avoid deadlocks */
     19 /* LOCK: underlying mutex should be acquired by this thread */
     20 /* GC: condvar should be rooted */
     21 void kcondvar_wait(klisp_State *K, TValue condvar);
     22 void kcondvar_signal(klisp_State *K, TValue condvar, bool broadcast);
     23 
     24 #define kcondvar_mutex(c_) (tv2condvar(c_)->mutex)
     25 #define kcondvar_cond(m_) (tv2condvar(m_)->cond)
     26 
     27 #endif