Exemple #1
0
static naRef f_semdown(naContext c, naRef me, int argc, naRef* args)
{
    if(argc > 0 && naGhost_type(args[0]) == &SemType) {
        naModUnlock();
        naSemDown(naGhost_ptr(args[0]));
        naModLock();
    }
    return naNil();
}
Exemple #2
0
static naRef f_semup(naContext c, naRef me, int argc, naRef* args)
{
    if(argc > 0 && naGhost_type(args[0]) == &SemType)
        naSemUp(naGhost_ptr(args[0]), 1);
    return naNil();
}
Exemple #3
0
static naRef f_unlock(naContext c, naRef me, int argc, naRef* args)
{
    if(argc > 0 && naGhost_type(args[0]) == &LockType)
        naUnlock(naGhost_ptr(args[0]));
    return naNil();
}
Exemple #4
0
static struct naIOGhost* ioghost(naRef r)
{
    if(naGhost_type(r) == &naIOGhostType && IOGHOST(r)->handle)
        return naGhost_ptr(r);
    return 0;
}