rem: SetSemaphore (bank[i].var);
add: WaitProtectedCondVar (bank[i].var, bank[i].control);  UnlockMutex (bank[i].control); LockMutex (bank_mutex); bank[i].used = bank[i].id = 0; UnlockMutex (bank_mutex);
context: WaitForSignal (){	int i;	int index = -1;	DWORD me = CurrentThreadID ();	for (i = 0; i < CONDVAR_BANK_SIZE; i++)	{		if (!bank[i].used)		{			index = i;			break;		}	}	if (index == -1)	{		/* The bank is full! */		fprintf(stderr, "Condvar bank is full, %ul is waiting on DCQ.", me);		UnlockMutex (bank_mutex);		WaitCondVar (RenderingCond);	}	else	{		bank[i].used = 1;		bank[i].id = me;		// Initialize the Semaphore to a value of '0' in case it isn't already		while (SemaphoreValue (bank[i].var))			SetSemaphore (bank[i].var);		UnlockMutex (bank_mutex);		// Block on Semaphore until it is cleared by the Signal		SetSemaphore (bank[i].var);	}}