Ich verwende TCL-Threads. Ich versuche, ein einfaches Programm zu schreiben, das 3 Threads und nur eine einfache Druckanweisung in jedem Thread öffnet.Warum TCL-Threads die Ausgabe nicht drucken
Unten finden Sie meine Code
package require Thread
puts "*** I'm thread [thread::id]"
# Create 3 threads
for {set thread 1} {$thread <= 3} {incr thread} {
set id [thread::create {
# Print a hello message 3 times, waiting
# a random amount of time between messages
for {set i 1} {$i <= 3} {incr i} {
after [expr { int(500*rand()) }]
puts "Thread [thread::id] says hello"
}
}] ;# thread::create
puts "*** Started thread $id"
} ;# for
puts "*** Existing threads: [thread::names]"
# Wait until all other threads are finished
while {[llength [thread::names]] > 1} {
after 500
}
puts "*** That's all, folks!"
Unterhalb der Ausgang
*** I'm thread tid00004028
*** Started thread tid0000A5E8
*** Started thread tid00009F28
*** Started thread tid00009D54
*** Existing threads: tid00009D54 tid00009F28 tid0000A5E8 tid00004028
*** That's all, folks!
Funktioniert für mich, wenn ich den genauen Code versuche. –
Was ist das Drucken? Können Sie die Ausgabe zeigen – Nitesh
Ich verwende Tcl 8.4 in Windows – Nitesh