Re: No argv, argc for worker thread
- From: "Bob Binder" <nospam@xxxxxxxxxx>
- Date: Sun, 12 Mar 2006 18:14:58 -0600
Don, Gerald
I expected that a Tcl interpreter started in any manner would accept options
from its invoker and make them visible to scripts running in the resulting
interpreter.
Why?
* This is how the interpreter works with command line options
* Nearly all Tcl commands accept options of some kind, which are typically
visible in the target
* Using "args" in the proc and itcl method signature supports several Tcl
idioms
* Nothing in the Thread documentation indicates to the contrary
* Passing a list of options from the invoker which are visible to the target
is so common in Tcl, I'm really surprised that this isn't supported when
starting an interp in a thread or as a slave.
So, why not allow options to be passed in and made visible in the global
namespace?
The project at hand launches processes for Tcl app components, passing in
start up command line arguments. I'm refactoring a large component into
several threads. In all components, a "main" script processes command line
options. It then starts scripts or worker threads. The first thing done in
the worker thread is to run this same main script, which establishes the
common run time environment. So, to start a threaded component, I wanted
generate an options list and pass it along with the thread::create command,
just as I'm doing elsewhere. The common main script would process startup
options the same way in a worker thread as it does in the main thread. I
couldn't get that to work and implemented setting argv and argc using
variable passed through the tsv.
The purpose of my query was to confirm that what seemed to be a kluge was
necessary, and thanks for establishing that it its. Deciding whether this
asymmetry is feature or a gotcha is left as an exercise.
Bob
.
- Follow-Ups:
- Re: No argv, argc for worker thread
- From: Don Porter
- Re: No argv, argc for worker thread
- From: Neil Madden
- Re: No argv, argc for worker thread
- References:
- No argv, argc for worker thread
- From: Bob Binder
- Re: No argv, argc for worker thread
- From: Don Porter
- No argv, argc for worker thread
- Prev by Date: GVI, The Graphical Voter Interface
- Next by Date: Cordumping spawn from expect.
- Previous by thread: Re: No argv, argc for worker thread
- Next by thread: Re: No argv, argc for worker thread
- Index(es):
Relevant Pages
|