in reply to Re: To thread or not to thread
in thread To thread or not to thread

I can even see situations where you would want to do both at the same time.

Really? When?

Butenhof warns against it ... "avoid using fork in a threaded program (if you can) unless you intend to exec a new program immediately". (Programming w/ POSIX Threads p197).

There are lots of complications associated with it. In pthreads, only the thread that calls fork exists in the parent. But it does have a copy of all the mutexes etc that existed in the parent. So you must define a 'fork handler' which allows you to do certain cleanup at the time the fork happens (in the parent and the child).

I think it would be a case of mixing fairly incompatible paradigms ...

--
Ash OS durbatulk, ash OS gimbatul,
Ash OS thrakatulk, agh burzum-ishi krimpatul!
Uzg-Microsoft-ishi amal fauthut burguuli.

Replies are listed 'Best First'.
Re^3: To thread or not to thread
by Aristotle (Chancellor) on May 30, 2002 at 14:39 UTC
    You can have a nonthreading parent whose children use threads for their business easily then, by your explanations. As I understand, that's a bit like what Apache 2.0 will be doing, which, too, mixes threads and forks largely depending on platform.

    Makeshifts last the longest.