A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
19
Task/Fork/Tcl/fork.tcl
Normal file
19
Task/Fork/Tcl/fork.tcl
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
package require Expect
|
||||
# or
|
||||
package require Tclx
|
||||
|
||||
for {set i 0} {$i < 100} {incr i} {
|
||||
set pid [fork]
|
||||
switch $pid {
|
||||
-1 {
|
||||
puts "Fork attempt #$i failed."
|
||||
}
|
||||
0 {
|
||||
puts "I am child process #$i."
|
||||
exit
|
||||
}
|
||||
default {
|
||||
puts "The parent just spawned child process #$i."
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue