diff options
| author | fukachan <fukachan> | 2006-02-04 07:54:37 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2006-02-04 07:54:37 +0000 |
| commit | 9e973773ed8e8f99ae7ed8508f559c714cacec84 (patch) | |
| tree | 9cf5c05a53588ed33b799ef29c9e8883bb0917fc | |
| parent | e5796d8dff03c3aa63b1c9efed4b6d8289a8f55b (diff) | |
| download | fml8-9e973773ed8e8f99ae7ed8508f559c714cacec84.tar.gz fml8-9e973773ed8e8f99ae7ed8508f559c714cacec84.tar.bz2 fml8-9e973773ed8e8f99ae7ed8508f559c714cacec84.zip | |
prefer $hints if specified for argv, ARGV and options.
support context switching in executing new (child) process.
| -rw-r--r-- | fml/lib/FML/Process/Switch.pm | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/fml/lib/FML/Process/Switch.pm b/fml/lib/FML/Process/Switch.pm index b0a4e138..2a3c48d3 100644 --- a/fml/lib/FML/Process/Switch.pm +++ b/fml/lib/FML/Process/Switch.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: Switch.pm,v 1.112 2005/12/18 11:52:49 fukachan Exp $ +# $FML: Switch.pm,v 1.113 2006/01/09 14:00:54 fukachan Exp $ # package FML::Process::Switch; @@ -269,16 +269,24 @@ sub NewProcess $args->{ myname } = $new_myname; $args->{ program_name } = $new_myname; $args->{ program_fullname } =~ s/$old_myname/$new_myname/; - $args->{ argv } = [ $ml_addr ]; - $args->{ ARGV } = [ $ml_addr ]; + $args->{ argv } = $hints->{ argv } || [ $ml_addr ]; + $args->{ ARGV } = $hints->{ ARGV } || [ $ml_addr ]; $args->{ curproc } = {}; + if (defined $hints->{ options }) { + $args->{ options } = $hints->{ options }; + } + # overload options my $_opts = $hints->{ config_overload } || {}; for my $k (keys %$_opts) { $args->{ options }->{ o }->{ $k } = $_opts->{ $k }; } + # context switch (save current context) + my $saved_context = $curproc->context_switch_get_context(); + $curproc->set_process_title($new_myname); + # start a new process. eval q{ local(@ARGV) = ( $ml_addr ); @@ -289,6 +297,9 @@ sub NewProcess &FML::Process::Flow::ProcessStart($obj, $args); }; $curproc->logerror($@) if $@; + + # context switch (back again) + $curproc->context_switch_set_context($saved_context); } |
