File: comm.slaveboot

package info (click to toggle)
tcllib 1.19-dfsg-2
  • links: PTS
  • area: main
  • in suites: buster
  • size: 67,328 kB
  • sloc: tcl: 208,371; ansic: 14,215; sh: 2,846; xml: 1,766; yacc: 1,145; pascal: 583; makefile: 106; perl: 84; f90: 84; python: 33; ruby: 13; php: 11
file content (42 lines) | stat: -rw-r--r-- 1,010 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# -*- tcl -*-
# Script to boot a child running an open comm server

set spawncode [makeFile {
    catch {wm withdraw .}
    ##puts [set fh [open ~/foo w]] $argv ; close $fh

    source [lindex $argv 0]     ; # load 'snit'
    source [lindex $argv 1].tcl ; # load 'comm'
    # and wait for commands. But first send our
    # own server socket to the initiator
    ::comm::comm send [lindex $argv 2] [list slaveat [::comm::comm self]]
    vwait forever
} spawn]

proc slaveat {id} {
    #puts "Slave @ $id"
    proc slave {} [list return $id]
    set ::go .
}

#puts "self @ [::comm::comm self]"

exec \
    [info nameofexecutable] $spawncode \
    [tcllibPath snit/snit.tcl] \
    [file rootname [info script]] \
    [::comm::comm self] &

#puts "Waiting for spawned comm system to boot"
# Wait for the slave to initialize itself.
vwait ::go

#puts "Running tests"
#::comm::comm debug 1

proc slavestop {} {
    ::comm::comm send -async [slave] {{exit}}
    ::comm::comm abort
    removeFile spawn
    return
}