Overview
| Artifact ID: | 5aa4cd037077ae8c3d3da133442314f740e694ea |
|---|---|
| Ticket: | 518f1f22be08de2451152907b0136b0fe871e9ce
Thread package fails to consider the interp it was initially loaded from was deleted |
| User & Date: | anonymous on 2016-06-11 14:47:02 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
The thread package commands call a function named Init and passes along the caller's interpreter. Init caches the interp in thread local storage if it hasn't been set yet and uses it for all future invocations. If the interp is later deleted this will lead to an error ("attempt to call eval in deleted interpreter") when communicating with its parent thread via commands like thread::send. There is a demo of this here: http://paste.tclhelp.net/?id=idf If this is a Won't Fix I propose the docs be updated to warn against deleting the calling interp to save someone else some pain. Correcting the behavior seems trivial and shouldn't have any noticable performance impact. The function shown below seems to solve the problem: static void Init(interp) Tcl_Interp *interp; /* Current interpreter. */ { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); if (tsdPtr->interp == (Tcl_Interp*)NULL) { memset(tsdPtr, 0, sizeof(ThreadSpecificData)); tsdPtr->interp = interp; ListUpdate(tsdPtr); Tcl_CreateThreadExitHandler(ThreadExitProc, (ClientData)threadEmptyResult); } else if (Tcl_InterpDeleted(tsdPtr->interp)) { tsdPtr->interp = interp; } } - foundin changed to: "8.6.5"
- is_private changed to: "0"
- login: "anonymous"
- priority changed to: "5 Medium"
- private_contact changed to: "45acae529cab3ab98979b4963483a82f50bb42e5"
- resolution changed to: "None"
- severity changed to: "Minor"
- status changed to: "Open"
- submitter changed to: "anonymous"
- subsystem changed to: "80. Thread Package"
- title changed to:
Thread package fails to consider the interp it was initially loaded from was deleted
- type changed to: "Bug"