Artifacts Associated With Ticket d82a78ebf2b9ede7
Ticket change [afb7e6cf50] (rid 171358) by elfring on 2019-05-05 14:45:39:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
I have tried the following small script out for the software “TCL 8.6.9-1.5” on an openSUSE system. package require Thread puts {Thread creation} set id [thread::create { puts "The thread [thread::id] will sleep for a moment." after 1200 puts "The thread [thread::id] is waiting for work." thread::wait }] puts "Additional thread ($id) was created." puts {The main thread will sleep for a moment.} after 1230 puts {End of test case} Test result: elfring@Sonne:~/Projekte/TCL> tclsh test-thread1.tcl Thread creation The thread tid0x7fadfc763700 will sleep for a moment. Additional thread (tid0x7fadfc763700) was created. The main thread will sleep for a moment. The thread tid0x7fadfc763700 is waiting for work. End of test case I got the impression from such test output that the main thread is informed about the identification for the additional thread before the preparation script of this extra thread was finished. I find such software behaviour questionable in comparison to the provided documentation. https://www.tcl.tk/man/tcl/ThreadCmd/thread.htm#M6 I interpreted the information from the thread package manual in the way for a while that it would be possible to let the calling thread to continue with its work only after successful initialisation of a related task. There are some data processing consequences to consider if you can not depend on a known execution order there. How would you like to clarify this situation? - foundin initialized to: "8.6.9"
- is_private initialized to: "0"
- login: "elfring"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "elfring"
- subsystem initialized to: "80. Thread Package"
- title initialized to:
Clarify execution order for thread creation scripts
- type initialized to: "Bug"
Ticket change [61c4992dd5] (rid 171362) by sebres on 2019-05-06 12:11:37:
- closedate changed to: "2458610.0080711"
- closer changed to: "sebres"
- icomment:
Again, please use thread-repository for concerns of thread-package. BTW, which sentence in the documentation exactly you interpret as "let the calling thread to continue with its work only after successful initialisation of a related task"?<br/> I don't see something similar in the docu and in my opinion it was never the case in thread package...<br/> The caller thread gets an id of main thread immediately after its interpreter got created (ready)... However, if you want behavior like this, use constructs with synchronous thread::send like here: <code><pre style="padding-left:10pt"> set id [thread::create]; \ thread::send $id { puts "thread [thread::id] creating..."; flush stdout after 1200 puts "thread [thread::id] created."; flush stdout }; \ puts "MAIN: we have created $id"; flush stdout </pre></code> - login: "sebres"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Invalid"
- status changed to: "Closed"
Ticket change [0e8842c5a3] (rid 171364) by elfring on 2019-05-06 13:00:31:
- closedate changed to: "2458610.04203613"
- closer changed to: "elfring"
- icomment:
My interpretation of the documentation was influenced by the detail that it was not explicitly mentioned at which point the concurrent execution will be started for threads which are created by this programming interface.
- login: "elfring"
- mimetype: "text/plain"
Ticket change [418c55840c] (rid 171368) by elfring on 2019-05-06 13:37:17:
- closedate changed to: "2458610.06756161"
- icomment:
See also: https://core.tcl-lang.org/thread/tktview/f5a5c23f47bef3d709e85c7d1f5883e473b8125b
- login: "elfring"
- mimetype: "text/plain"