Re: Parallelling system_exec
- Posted by "Juergen Luethje" <j.lue at gmx.de> Jun 28, 2004
- 422 views
Andy wrote: > Patrick Barnes wrote: >> >> Wait.... >> >> I'm writing a script that just has to call an executeable roughly 20 >> times. All I want is for the code to return immediately from the >> system call, not wait for the executeable to finish (most of the time >> is on the server). >> >> There are no gui elements to this script at all... I don't want to be >> shackled to a gui library. >> > > The code I provided does just that -- allows you to run a program > without waiting on a return value. No GUI is needed, but it does use > the Windows API and Bernie's windows engine. To run something several > times without any interaction, just do: > > }}} <eucode> > handle = child_process("program.exe") > child_close(handle) > handle = child_process("program.exe") > child_close(handle) > handle = child_process("program.exe") > child_close(handle) > handle = child_process("program.exe") > child_close(handle) > </eucode> {{{ > > All 4 instances will start up nearly simulataneously, and the calling > program can go ahead and exit if desired... Why not use system()? It also calls the child processes asynchronously, or am I missing something? The following code works fine on my system (Windows 98):
system("explorer.exe.", 2) system("calc.exe.", 2) system("notepad.exe.", 2) system("charmap.exe.", 2)
Regards, Juergen