#ifndef NSPR_CONDVAR_H
#define NSPR_CONDVAR_H

struct CNCondVar
{
	CNLock* mutex;
	HANDLE gate;
	HANDLE queue;
	unsigned int gone;  // # threads that timed out and never made it to m_queue
    unsigned long blocked; // # threads blocked on the condition
    unsigned int waiting;
};

typedef struct CNCondVar CNCondVar;
typedef DWORD CNIntervalTime;

typedef CNCondVar PRCondVar;
typedef CNIntervalTime PRIntervalTime;

CNCondVar* CN_NewCondVar(CNLock *lock);
void CN_DestroyCondVar(CNCondVar *cvar);
CNStatus CN_WaitCondVar(CNCondVar *cvar, CNIntervalTime timeout);
CNStatus CN_NotifyCondVar(CNCondVar *cvar);
CNStatus CN_NotifyAllCondVar(CNCondVar *cvar);

#endif