Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Support change notifications for thread shared variables

Open6ff44a29cea4b3fb72634f551cecb5917f837cf2Created 8 years agoUpdated 8 years ago
Descriptionplain2019-05-03 12:17:04
I find the direct support for thread shared variables generally nice.
I would appreciate to get notified for changes in selected TCL variables.
How do you think about a collaboration of their internal locking with condition variables?
dgpplain2019-05-03 13:38:42
Can you explain why variable write traces are not what you seek?
elfringplain2019-05-05 05:45:44
The standard functionality from the TCL command “trace” can generally be nice.
But I suggest to take consequences from multi-threaded data processsing better into account.

It can happen that a thread would like to wait on a status change in the running software.
The TCL command “thread::cond wait” (and the function “Tcl_ConditionWait”) is an appropriate programming interface for this purpose.
https://www.tcl.tk/man/tcl/ThreadCmd/thread.htm#M42
https://tcl.tk/man/tcl8.7/TclLib/Thread.htm

The thread which will change shared resources would occasionally like to notify companions by using the corresponding condition variable.
https://en.wikipedia.org/wiki/Monitor_(synchronization)#Condition_variables
elfringplain2019-05-06 13:21:52
See also:
https://core.tcl-lang.org/thread/tktview/e7bcc945210ae351693ad9d526308b3d40bd645a
Log in (anonymous is fine) to add a comment.