Richard Lynch wrote:

>> I think you are mis-remembering, yes.  When your fork() call returns,
>> you have two separate processes, your child process being an exact
>> copy of your parent process. (mostly, see "copy-on-write").  The only
>> thing they share at this point are open file descriptors which have
>> also been copied, so they obviously point the the same file(s).
> 
> So they could easily corrupt the file by making assumptions about it.

Actually only if they make incorrect assumptions :-)

> More importantly, if you build and initialize some data structures
> before you fork, and if they each assume they have exclusive access to
> said data structures, your program ends up not being "thread-safe"

I'm sorry, you're wrong.  You don't seem to quite understand what fork()
does.  After the fork(), both processes will each have a copy of those
data structures, and they can both do whatever they like to them
without interfering with each other.  

Anyway, enough of this.  I'm done. 


/Per Jessen, Zürich

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to