Skip to content
Tcl Source Code View Ticket
Login

View Ticket

bug in Tcl_ConditionNotify for win build

Closed / Fixed849007ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 23 years ago
Descriptionplain2003-11-25 15:03:36
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.
 */
    }
}
davygrvyplain2003-12-06 01:51:52
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?
davygrvyplain2004-01-12 03:31:29
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.
davygrvyplain2004-01-12 03:39:32
Logged In: YES 
user_id=7549

change committed to HEAD.
Log in (anonymous is fine) to add a comment.