#176786 - 2007-06-06 10:30 AM
"CALL" without waiting
|
Lee Wilmott
Starting to like KiXtart
Registered: 2002-09-17
Posts: 106
Loc: Bristol, UK
|
I hope one of you guys can give me some inspiration… :-)
I want to “CALL” a KiX script from a KiX script – but I don’t want the first script to wait for the second KiX script to complete before continuing.
I realise I could call the second script by using the “RUN” statement. Using this method would require that I specify the kix32.exe interpreter and the name of my second script – which isn’t too much of a problem.
However, it would be nice if I could ‘call’ the second script without executing a second interpreter.
It would be nice if the “CALL” statement had an optional argument…
CALL “script name” [, WaitState]
Where an optional WaitState represents…
0 = Wait until called script finishes before continuing with the first script. This would be the default and current behaviour. 1 = Continue first script without waiting for called script to complete.
Does anyone have any ideas on how I can do what I want? In addition, what do you think of the “CALL” statement with the optional argument.
Thanks in advance,
Lee
|
Top
|
|
|
|
#176791 - 2007-06-06 10:53 AM
Re: "CALL" without waiting
[Re: Mart]
|
Lee Wilmott
Starting to like KiXtart
Registered: 2002-09-17
Posts: 106
Loc: Bristol, UK
|
I didn't think there was a way. :-(
Just a small comment about the waitste option. If it makes it into the kix executables it should be an optional parameter. It should default to the current behavior when the parameter is not supplied because it would break a lot of scripts if it was mandatory imho.
I couldn't agree with you more - no question about it. In fact, it was because of that reason why I suggested an "optional" argument and suggested the default ought be the current behaviour! ;-)
If others like the idea then I'll post this suggestion in the "Suggestions" forum (and reference this post).
Any takers?
Thanks for your comments Mart!
Lee
|
Top
|
|
|
|
#176797 - 2007-06-06 01:48 PM
Re: "CALL" without waiting
[Re: Arend_]
|
Glenn Barnas
KiX Supporter
![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif)
Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
|
Before that even batch scripts didn't wait for a command to finish. I gotta disagree here. BAT files have been synchronous until NT/Win32, when the "Start" command was introduced. This allowed you to spawn the command as a child process and allow continued execution of the script. "Start" takes a WAIT arg to allow the script to wait while the command runs in a separate child environment. Of course, there have always been apps you call from a bat file that spawn a child that continues - Oracle Client installer is one of those insidious processes!
As for Call NoWait, it would be useful to me, since I currently have a multi-threaded Kix app that processes hundreds of small tasks, and maintains about 25 running at any one time. This is used to generate daily system reports, and running them serially by one process can take several hours. Running them multi-threaded, the task is done in under 15 minutes (with 100% CPU load for much of that time). Using Call NoWait would allow me to embed the external script as a function and save quite a bit of system resources.
It's important to realize that any process you do not wait for must be independent - it will not return status or values! (Just like Run - it doesn't return values, and the status it returns is based on how the command started, not ended.) It must handle its own data (although should be able to receive values) and deal with its own errors.
The huge advantage of a Call Nowait would be that the Kix environment would be inherited (hopefully as a copy), which is not what happens with Run/Shell.
Glenn
_________________________
Actually I am a Rocket Scientist!
|
Top
|
|
|
|
#176798 - 2007-06-06 03:09 PM
Re: "CALL" without waiting
[Re: Glenn Barnas]
|
Lee Wilmott
Starting to like KiXtart
Registered: 2002-09-17
Posts: 106
Loc: Bristol, UK
|
Thanks for your comments guys. Do I have enough support here to allow me to create a post in the "Suggestions" forum? :-)
Lee
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 138 anonymous users online.
|
|
|