Multi process handling in TCl script

Posted by swanup on 2017-04-16 22:44

Need solution for parallel processing in tcl (windows).

I tried with thread, still not able to achieve desired output.

To simplify My requirement I am giving a simple example as following. Requirement: I want to run notepad.exe without effecting my current execution of flow. From main thread control should go to called thread, start notepad.exe and come back to main thread with out closing the notepad .

Tried:(Tcl script)

package require Thread

set a 10

proc test_thread {b} {

puts "in procedure $b"
set tid [thread::create] ;# Create a thread
return $tid
}

puts "main thread"

puts [thread::id]

set ttid [test_thread $a]

thread::send $ttid {exec c:/windows/system32/notepad.exe &}

puts "end"

Getting Output: running notepad without showing any log. when closing notepad application I am getting following output.

main thread

tid0000000000001214

in procedure 10

end

Desired output: main thread

tid0000000000001214

in procedure 10

---->> control should go to thread and run notepad.exe with out effecting main thread flow. <<------- end

So kindly help to solve this issue and if appart from thread concept any other is there please let me know.