I do have a question regarding that though.
If I were to write fork, I'd make it take a function to call when the process 
is recreated. I have seen a bunch of examples of fork, but it looks like after 
they fork it starts after the fork call? or how does that work.



Thanks,
Tyler Littlefield
Web: tysdomain.com
email: ty...@tysdomain.com
My programs don't have bugs, they're called randomly added features.

  ----- Original Message ----- 
  From: Thomas Hruska 
  To: c-prog@yahoogroups.com 
  Sent: Tuesday, April 07, 2009 8:33 AM
  Subject: Re: [c-prog] C language


  Brett McCoy wrote:
  > On Tue, Apr 7, 2009 at 9:38 AM, Thomas Hruska <thru...@cubiclesoft.com> 
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/



  

[Non-text portions of this message have been removed]

Reply via email to