Changeset a168f52 in tol
- Timestamp:
- Dec 6, 2010, 9:22:59 PM (16 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- 4e49e21
- Parents:
- 10a207c
- Location:
- tolsh/tolsh.vfs/lib
- Files:
-
- 3 edited
-
app-tolsh/tolsh.tcl (modified) (5 diffs)
-
tolcomm/tolserver.tcl (modified) (4 diffs)
-
tolcomm/tolshared.tcl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tolsh/tolsh.vfs/lib/app-tolsh/tolsh.tcl
r10a207c ra168f52 166 166 set options(runmode) "slave" 167 167 } elseif {$opt eq "shared"} { 168 # the next argument is the port number 169 set options(shared,port) [lindex $cmdline [expr {$i+1}]] 170 incr i 168 171 if {$options(runmode) ne "" && $options(runmode) ne "shared"} { 169 172 puts "Replacing previous run mode '$options(runmode)' with 'shared'" 170 173 } 171 174 set options(runmode) "shared" 175 } elseif {$opt eq "shport"} { 176 # the next argument is the port number 177 set options(shared,port) [lindex $cmdline [expr {$i+1}]] 178 incr i 172 179 } else { 173 180 append delayed_msg "\nignoring unknown option: '$item'" … … 444 451 } elseif {$options(runmode) eq "shared"} { 445 452 puts "runmode=shared" 446 run_as_shared 453 run_as_shared $tolcomm_dir 447 454 448 455 } elseif {$options(runmode) eq "slave"} { … … 456 463 package require tolserver 457 464 458 clone465 set shared_port [ clone ] 459 466 tolserver::start -port $options(server,port) \ 467 -shport $shared_port \ 460 468 -logfile [file join $tolcomm_dir "tolserver.log"] \ 461 469 -compile $options(compile) … … 463 471 } 464 472 473 proc ::tolsh::find_shared_port { port } { 474 puts "::tolsh::find_shared_port $port" 475 set i 0 476 while { $i < 100 } { 477 if { [ catch { socket localhost $port } fd ] } { 478 puts "find_shared_port OK = $port" 479 return $port 480 } 481 incr port 482 incr i 483 } 484 puts "find_shared_port FAIL!" 485 return 0 486 } 487 465 488 proc ::tolsh::clone {} { 466 489 variable options … … 471 494 lappend tolsh $::argv0 472 495 } 473 eval exec $tolsh -shared & 496 set shared_port [ find_shared_port 20458 ] 497 if { !$shared_port } { 498 puts "::tolsh::clone: could not find a valid port for shared data" 499 exit 500 } 501 eval exec $tolsh -shared $shared_port & 474 502 after 5000 ;# wait for data sharing are created by 'shared' 475 503 puts "exec slave" 476 eval exec $tolsh -slave $options(server,port) & 477 } 478 479 proc ::tolsh::run_as_shared {} { 504 eval exec $tolsh -slave $options(server,port) -shport $shared_port & 505 return $shared_port 506 } 507 508 proc ::tolsh::run_as_shared { tolcomm_dir } { 480 509 package require tolshared 481 482 tolshared::start 510 variable options 511 512 tolshared::start $options(shared,port) $tolcomm_dir 483 513 } 484 514 485 proc ::tolsh::run_as_slave { tolcomm_dir} {515 proc ::tolsh::run_as_slave { tolcomm_dir } { 486 516 variable options 487 517 package require tolslave 488 518 489 tolslave::start -port $options(server,port) \519 tolslave::start -port $options(server,port) -shport $options(shared,port) \ 490 520 -logfile [file join $tolcomm_dir "tolslave.log"] 491 521 vwait __forever__ -
tolsh/tolsh.vfs/lib/tolcomm/tolserver.tcl
r10a207c ra168f52 452 452 array set options { 453 453 -port 6669 454 -shport 20458 454 455 -logfile "" 455 456 -compile "" … … 467 468 } 468 469 469 server_attach_data 470 server_attach_data $options(-shport) 470 471 471 472 log "debug" "shared_tasks(init)=$options(-compile)" … … 474 475 } 475 476 476 proc ::tolserver::server_attach_data { } {477 proc ::tolserver::server_attach_data { shared_port } { 477 478 package require tequila 478 479 global shared_tasks … … 480 481 global shared_finish 481 482 482 tequila::open localhost 20458483 tequila::open localhost $shared_port 483 484 tequila::attach shared_tasks 484 485 tequila::attach shared_state -
tolsh/tolsh.vfs/lib/tolcomm/tolshared.tcl
r10a207c ra168f52 22 22 # 23 23 ############################################################################### 24 proc ::tolshared::start { } {24 proc ::tolshared::start { port datadir } { 25 25 global tqs_info 26 26 package require Mk4tcl … … 28 28 29 29 puts "::tolshared::start" 30 mk::file open tqs tequilas.dat -nocommit 30 # OJO: este archivo hay abrirlo en algun directorio controlado 31 mk::file open tqs [ file join $datadir tequilas.${port}.dat ] -nocommit 31 32 set tqs_info(verbose) 0 ;# default logging is off 32 33 TqsTimer "" ;# default commit timer is 30 seconds 33 tqsRun 20458;# default port is 2045834 tqsRun $port ;# default port is 20458 34 35 }
Note: See TracChangeset
for help on using the changeset viewer.
