fork()
, wait()
, and threads
Something I've discovered through (painful) experience is that threaded
programs cannot portably fork()
in one thread and then wait()
for
the forked process in another one.
This will work in some environments but fail explosively in others; the one I stubbed my toe on was a Linux 2.4 kernel based system (without NPTL, which is the usual state of affairs for 2.4-based Linux distributions).
Admittedly, mixing threads and fork()
is a bit perverse, but
sometimes it's what you need to do.
(I saw this in a Python program, but Python isn't doing anything special in the POSIX threads department so I have to expect that it's completely generic.)
Comments on this page:
|
|