Artifacts Associated With Ticket 872298ffffffffff
Ticket change [2bc5aa5b61] (rid 118801) by elfring on 2004-01-07 11:25:25:
- assignee initialized to: "andreas_kupries"
- cmimetype initialized to: "text/plain"
- comment initialized to:
One part of thread-safe programming is to avoid global variables. But some of them must continue to exist because they are essential for several functions. 1. Can the direct access (set varname ...) be converted to a function call like it is done for "errno" in C? 2. How do you think about to add an option to the function "http://tcl.tk/man/tcl8.4/TclCmd/global.htm"? global -synchronized varname ?varname ...?
- foundin initialized to: "None"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "elfring"
- subsystem initialized to: "49. Threading"
- title initialized to: "Locked access to global variables"
- type initialized to: "RFE"
Ticket change [38b030db87] (rid 112254) by dkf on 2004-01-07 18:51:18:
- closedate changed to: "2004-01-07T11:51:18"
- closer changed to: "dkf"
- icomment:
Logged In: YES user_id=79902 This FRQ is invalid because Tcl and the thread extension already provide all the tools required. If there is anything further needed, it should be prototyped within the context of tcllib first. On your specific points: 1) http://tcl.tk/man/tcl8.4/TclCmd/trace.htm (and there is an equivalent mechanism at the C level) allows all Tcl variable reads and writes to be trapped and clever things done. 2) Global variables are just global to an interpreter (except for the ::env array, which is deeply magical, messy, and has proper locking behind the scenes IIRC.) Interpreters are always single-threaded; multi-threaded Tcl has multiple interpreters, but each interp is constrained to a single thread (this is a fundamental design model thing.) Hence a -synchronized option is (mostly) irrelevant as all variable accesses are already sufficiently synchronized; the shared-variable stuff in the thread package (which I believe you already know about) is how you get variables visible across multiple interpreters.
- login: "dkf"
- mimetype: "text/plain"
- resolution changed to: "Invalid"
- status changed to: "Closed"
- username: "dkf"
Ticket change [0bee9d8641] (rid 114087) by elfring on 2004-01-07 19:56:02:
- assignee changed to: "dkf"
- icomment:
Logged In: YES user_id=572001 Thanks for this clear answer. 2) I thought that multiple threads can run in one interpreter. - That's not the case at the moment. I know the tsv functions. I hope that the libraries I'm working with do also their job with requests from different interpreters in a single process without thread safety problems.
- login: "elfring"
- mimetype: "text/plain"
- username: "elfring"