Menu

#2542 bug in Tcl_ConditionNotify for win build

obsolete: 8.4.5
closed-fixed
5
2004-01-11
2003-11-25
Anonymous
No

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.
*/
}
}

Discussion

  • David Gravereaux

    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?

     
  • David Gravereaux

    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.

     
  • David Gravereaux

    • assigned_to: andreas_kupries --> davygrvy
     
  • David Gravereaux

    Logged In: YES
    user_id=7549

    change committed to HEAD.

     
  • David Gravereaux

    • status: open --> closed-fixed