Brett McCoy wrote:
> On Tue, Apr 7, 2009 at 9:38 AM, Thomas Hruska <[email protected]> wrote:
>> Brett McCoy wrote:
> 
>>> Did you try using system()? It only returns after the called program
>>> finishes running.
>>>
>>> Note that the exec...() family of calls will replace the current
>>> process image with the new one that has been called. Normally you
>>> would would fork() first and then call exec...().
>> That won't happen under Windows.  Windows doesn't offer a mechanism to
>> do what Linux exec() does.
> 
> Oooh... really? Didn't know that.
> 
> -- Brett
> ------------------------------------------------------------
> "In the rhythm of music a secret is hidden;
>     If I were to divulge it, it would overturn the world."
>                -- Jelaleddin Rumi

Under *NIX, exec() overwrites the current process working set with a new 
process and starts at the entry point of the new process.  fork() starts 
a new process by copying the working set of the current process and 
continuing in both processes from there.

Windows has no built-in equivalent mechanism.  There is no API to copy a 
working set to a new process.  And there is also no API to overwrite the 
current working set with another process and start over.

CreateProcess() is essentially a combined fork()-exec() call.  The way 
that API was designed makes it really hard to separate that singular 
call into two separate components.

The way Windows is designed, creating a true fork()/exec() set would be 
VERY difficult.  The numerous types of HANDLEs would have to be 
duplicated precisely and not all HANDLEs are well-suited for that.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/

Reply via email to