Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: afb7e6cf502436683f16bacc4b7ae443c7d2357e96a1e55b2ff696536c059745
Ticket: d82a78ebf2b9ede7aa6b87b47b3f316d0c0c816e
Clarify execution order for thread creation scripts
User & Date: elfring on 2019-05-05 14:45:39
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed 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?
    
  5. foundin changed to: "8.6.9"
  6. is_private changed to: "0"
  7. login: "elfring"
  8. priority changed to: "5 Medium"
  9. resolution changed to: "None"
  10. severity changed to: "Minor"
  11. status changed to: "Open"
  12. submitter changed to: "elfring"
  13. subsystem changed to: "80. Thread Package"
  14. title changed to:
    Clarify execution order for thread creation scripts
    
  15. type changed to: "Bug"