threads/101323: fork(2) in threaded programs broken.
Daniel Eischen
deischen at freebsd.org
Thu Aug 3 20:19:45 UTC 2006
On Thu, 3 Aug 2006, Poul-Henning Kamp wrote:
> In message <Pine.GSO.4.64.0608031558540.13543 at sea.ntplx.net>, Daniel Eischen wr
> ites:
>
>
>> There's no easy way to hold all library locks. They are
>> littered in libc and libpthread and the application doesn't
>> have access to them. You would have to teach libc to
>> record these locks and export a function to lib<thread>
>> to lock and unlock these them.
>
> I would be perfectly happy if libpthread would just at the very
> least release the locks it specifically grabs for the fork.
>
> There's a big difference between giving it a sensible shot and
> downright sabotaging it the way we do currently.
Actually, I would prefer to emit an error message of the
form:
"fork() from a threaded process is not defined by POSIX"
and purposefully segfault ;-)
> Anyway, apart from the view from the theoretical high ground and
> the fact that POSIX doesn't actually say anything helpful here, are
> there any objections to the fix I proposed ?
For that one specific change, no objection. I have an
objection to enabling the NOTYET in thr_kern.c without
having an overall solution for libc as well.
--
DE
More information about the freebsd-threads
mailing list