Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Active*Trace inadequate?

Closed / Invalid1224553fffffffffffffffffffffffffffffffffCreated 21 years agoUpdated 21 years ago
Descriptionplain2005-06-21 01:41:32
dgp... ActiveVarTrace usage?

[21:17]dgpit's a pattern used in traces to allow for
trace deletion during trace execution
[21:18]dgpa simple for loop would fail.
[21:20]miguelI did not understand that last sentence
[21:20]dgpfor (t=varPtr->tracePtr; t!=NULL;
t=t->nextPtr) {
    runtrace(t)
}
[21:20]dgpthat's a simple (and wrong) strategy for
stepping through the traces on a variable.
[21:21]dgpwrong because runtrace() can destroy t,
leaving t->nextPtr as an invalid operation.
[21:22]miguelok
[21:22]dgpso ActiveVarTrace values are used to bridge
the gap
[21:22]dgpoversimplified:
[21:23]dgpfor (t=varPtr->tracePtr; t!=NULL; t=a) {
    a = t->nextPtr;
    runtrace(t)
}
[21:23]dgpbut I'm wondering why that's not also
wrong, just under different circumstances.
[21:24]miguelyou mean: if runtrace(t) destroys
t->nextPtr directly, for instance?
[21:24]dgpand 1201035 is apparently due to the
difficulty in applying the same trick when stepping
backward through the list.
[21:24]dgpyes.
[21:26]miguelmmhhh ....
[21:26]dgpI suppose its much less likely
[21:28]miguelmaybe struct VarTrace should be richer -
some refCount, some "deleted" value to its flags could
help managing these lifetime issues?
[21:28]miguelalthough "deleted" could be signalled by
having traceProc==NULL too
dgpplain2005-06-21 08:49:05
Logged In: YES 
user_id=80530


now I see;  the ActiveVarTrace records
get linked into a list attached to the
interp...

...and all trace deletions walk that list
to keep thing consistent.
Log in (anonymous is fine) to add a comment.