Mailinglist Archive: opensuse-programming (51 mails)

Re: [suse-programming-e] threads and file descriptors

From:
Matthias Hopf <mhopf@xxxxxxx>

Date:
Tue, 9 May 2006 14:13:33 +0200

Message-id:
<20060509121333.GD21946@xxxxxxx>

On May 08, 06 10:38:26 -0400, Jerry Feldman wrote:
> It is tedious to do this, but you really need to track every open(2) and
> close(2). You also have a complicated system where you are using BOTH
> threads and forks.
> Be very careful of using fork(2) from threads. To quote from Dave Butenhof,
> "Avoid using forkin a threaded program (if you can) unless you intend to
> exec a new program immediately".
> Page 197 "Programming with POSIX Threads".

Why that? Yes, you have to be carefull about open file descriptors and
memory maps (and other IPC stuff), but it should work. Apache is
successfully using a mixture of threads and processes.