/* destroy the mutex */
if (f->mutex) {
- vtmtxclrlock(f->mutex);
if (f != sfstdin && f != sfstdout && f != sfstderr) {
- vtmtxclose(f->mutex);
f->mutex = NIL(Vtmutex_t *);
}
}
if (options != 0)
return -1;
- vtmtxlock(_Sfmutex);
-
for (w = Wait, last = NIL(Waitpid_t *); w; last = w, w = w->next) {
if (pid > 0 && pid != w->pid)
continue;
pid = w->pid;
free(w);
- vtmtxunlock(_Sfmutex);
return pid;
}
if (status)
*status = ps;
- vtmtxunlock(_Sfmutex);
return pid;
}
Wait = w;
}
- vtmtxunlock(_Sfmutex);
return -1;
}
static Vtonce_t Sfonce = VTONCE_INITDATA;
static void _sfoncef(void)
{
- vtmtxopen(_Sfmutex, VT_INIT);
- vtmtxopen(&_Sfpool.mutex, VT_INIT);
- vtmtxopen(sfstdin->mutex, VT_INIT);
- vtmtxopen(sfstdout->mutex, VT_INIT);
- vtmtxopen(sfstderr->mutex, VT_INIT);
_Sfdone = 1;
}
if (p->sigp) {
Sfsignal_f handler;
- vtmtxlock(_Sfmutex);
if ((handler = signal(SIGPIPE, ignoresig)) != SIG_DFL &&
handler != ignoresig)
signal(SIGPIPE, handler); /* honor user handler */
_Sfsigp += 1;
- vtmtxunlock(_Sfmutex);
}
#endif
status = -1;
#ifdef SIGPIPE
- vtmtxlock(_Sfmutex);
if (p->sigp && (_Sfsigp -= 1) <= 0) {
Sfsignal_f handler;
if ((handler = signal(SIGPIPE, SIG_DFL)) != SIG_DFL &&
signal(SIGPIPE, handler); /* honor user handler */
_Sfsigp = 0;
}
- vtmtxunlock(_Sfmutex);
#endif
}
#define EPERM 1
#endif
- extern Vtmutex_t *vtmtxopen(Vtmutex_t *, int);
- extern int vtmtxclose(Vtmutex_t *);
- extern int vtmtxlock(Vtmutex_t *);
- extern int vtmtxtrylock(Vtmutex_t *);
- extern int vtmtxunlock(Vtmutex_t *);
- extern int vtmtxclrlock(Vtmutex_t *);
-
extern void *vtstatus(Vthread_t *);
extern int vterror(Vthread_t *);
extern int vtmtxerror(Vtmutex_t *);
#define VTONCE_INITDATA {0}
-#define vtmtxopen(mtx,flgs) (void)((Vtmutex_t*)0)
-#define vtmtxclose(mtx) (void)(-1)
-#define vtmtxlock(mtx) (void)(-1)
-#define vtmtxtrylock(mtx) (-1)
-#define vtmtxunlock(mtx) (void)(-1)
-#define vtmtxclrlock(mtx) (void)(-1)
-
#define vtstatus(vt) ((void*)0)
#define vterror(vt) (0)
#define vtmtxerror(mtx) (0)