in the first if, need the '*' !! (ie. *condPtr)
the following code, is after the fix.
void
Tcl_ConditionNotify(condPtr)
Tcl_Condition *condPtr;
{
WinCondition *winCondPtr;
ThreadSpecificData *tsdPtr;
if (*condPtr != NULL) {
winCondPtr = *((WinCondition **)condPtr);
/*
* Loop through all the threads waiting on the
condition
* and notify them (i.e., broadcast
semantics). The queue
* manipulation is guarded by the per-
condition coordinating mutex.
*/
EnterCriticalSection(&winCondPtr->condLock);
while (winCondPtr->firstPtr != NULL) {
tsdPtr = winCondPtr->firstPtr;
winCondPtr->firstPtr = tsdPtr->nextPtr;
if (winCondPtr->lastPtr == tsdPtr) {
winCondPtr->lastPtr = NULL;
}
tsdPtr->flags = WIN_THREAD_RUNNING;
tsdPtr->nextPtr = NULL;
tsdPtr->prevPtr = NULL; /* Not strictly
necessary, see A: */
SetEvent(tsdPtr->condEvent);
}
LeaveCriticalSection(&winCondPtr->condLock);
} else {
/*
* Noone has used the condition variable, so
there are no waiters.
*/
}
}
Logged In: YES
user_id=7549
Could the author please explain this. I don't seem to
understand. What's the diff to the current code?
Logged In: YES
user_id=7549
I see the fix now, and is valid. The old 'if (condPtr != NULL)'
will always be true. Yes, must be dereferenced.
Logged In: YES
user_id=7549
change committed to HEAD.