Per Jessen wrote: > No you don't. Try this example - think about running the same shell > script twice, but concurrently. Exactly the same code (the shell > script interpreter), but not necessarily thread-safe. Try running two > copies of the mysql cli - same code, but also not thread-safe. You > can fork() any number of processes using the same code without ever > needing to worry about thread safety. Perhaps this wasn't exactly the most obvious example. Thread-safety is essentially a matter of shared resources. And a child and parent process don't share any resources - apart from possible open files at time of fork(). Both processes can carry on reading and writing from those files, and although this will probably cause unwanted results, it's not a thread-safety issue. Thread-safety is an issue when you have two threads both trying to update the same linked list for instance. To guarantee the list integrity, you need to make sure the update happens atomically. Same thing with a shared counter for instance. Once you have secured your list/counter update code with spinlocks, mutexes or whatever method you chose, your code is thread-safe. This is not a problem for two forked processes - they don't have access to the same address-space. Which is why forking and thread-safety are not related. Apologies for taking so long before I changed the Subject line. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php