int Ns_InitializeEvent(Ns_Event *event) { Ns_CondInit((Ns_Cond *) event); return NS_OK; }
void Ns_SemaInit(Ns_Sema *semaPtr, int count) { static unsigned int nextid = 0; Sema *sPtr; sPtr = ns_malloc(sizeof(Sema)); sPtr->count = count; NsMutexInitNext(&sPtr->lock, "sm", &nextid); Ns_CondInit(&sPtr->cond); *semaPtr = (Ns_Sema) sPtr; }
static pthread_cond_t * GetCond(Ns_Cond *cond) { if (*cond == NULL) { Ns_MasterLock(); if (*cond == NULL) { Ns_CondInit(cond); } Ns_MasterUnlock(); } return (pthread_cond_t *) *cond; }