|
2001-08-21
| ||
| 00:35 | • Closed ticket [451328ffff]: thread problem with Tcl_GetStringFromObj plus 3 ... artifact: ff6165a9d8 user: andreas_kupries | |
|
2001-08-16
| ||
| 09:04 | • Ticket [451328ffff]: 4 changes artifact: be497cb5a1 user: davygrvy | |
| 08:52 | • Ticket [451328ffff]: 4 changes artifact: 8079443a8d user: andreas_kupries | |
| 05:22 | • Ticket [451328ffff]: 2 changes artifact: 34b2262ad3 user: msofer | |
|
2001-08-15
| ||
| 21:42 | • New ticket [451328ffff]. artifact: 2c9dd1e1da user: stevenashe | |
thread problem with Tcl_GetStringFromObj
Closed / Invalid451328ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 25 years ago
Descriptionplain2001-08-15 21:42:49
Hello. Might there is a problem with Tcl_GetString[FromObj]? As the code [but not the man page :-( ] indicates, the result is transient, pending some other call that changes the internal representation in the object. In a preemptive threaded environment, that "other call" can happen asynchronously, meaning that the return value from Tcl_GetStringFromObj is guaranteed valid at NO time (!); there is no guarantee the user can even copy the data. Either I'm being stupid, or this would seem to be something of a problem.
msofer Ticket [451328ffff]: 2 changes
[History diff]2001-08-16 05:22:46
andreas_kupriesplain2001-08-16 08:52:18
Logged In: YES user_id=75003 Tcl follows the one thread per interp model. This means one thread may contain a complete hierarchy of interpreters, but all interpreters in that hierarchy may only be accessed by their thread and _no_ other. For Tcl_Obj's this implies that an object with a refcount > 1 must not be shared between interpreters in different threads. Else the complications mentioned above arise. To access some information in more than one thread it is necessary to duplicate the object in question and then transfer this unshared object via an event to the other thread.
davygrvyplain2001-08-16 09:04:50
Logged In: YES user_id=7549 As Andreas says correctly, your assumption of thread safety with Tcl's API is out-of-bounds with its intended design. See http://dev.scriptics.com/doc/howto/thread_model.html See the thread extension also for how to share variables across threads. You can pass Tcl_Obj pointers to threads just fine. Just don't do any operations on them.
andreas_kupries Closed ticket [451328ffff].
[History diff]2001-08-21 00:35:31
Log in (anonymous is fine) to add a comment.