in reply to Re^2: Using forks and threads
in thread Using forks and threads
You really should read up on the pthreads libraries for your system, or perform a few experiments, to determine what happens when you fork a multi-threaded process. Personally I favour the latter approach as it generally yields quicker results.
A quick scan around suggests that POSIX/Solaris pthreads libraries map fork(2) to forkl(2) which only clones the calling thread, in which case it *ought* to be safe to use fork and threads in the same process which would greatly simplify what you describe. However, sucking and seeing is the only way to be sure.
If Perl's fork isn't compatible with threads on your system and you need to resort to forking early and running your system calls in a separate process, then I don't see much value in using threads. Using one process to run the user interface, and another to run the background processing would seem to be sufficient. Adding a second thread in the first process would simply complicate things as far as I can see.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Using forks and threads
by ColinHorne (Sexton) on Jul 22, 2006 at 03:05 UTC | |
by BrowserUk (Patriarch) on Jul 22, 2006 at 09:51 UTC |