Re: using of fork() in multithreaded application
Jörg Sonnenberger <[email protected]>
| Newsgroups | gmane.os.netbsd.devel.kernel |
|---|---|
| Message-ID | <[email protected]> |
On 1/24/25 1:27 PM, Greg Troxel wrote: > Taylor R Campbell <[email protected]> writes: > >>> Date: Wed, 22 Jan 2025 16:47:13 +0100 >>> From: Peter Skvarka <[email protected]> >>> >>> I have two questions: >>> Is safe using of fork() in NetBSD 10.1 in mutlithreaded application ? >> >> Generally yes, with the caveat that it is difficult for applications >> to use correctly. > > In 2010ish I saw a hard-to-find bug, the details of which are now fading > from memory. I think it was some kind of lock taken in a routine that > was called after fork and before exec. I think the program was python > and the lock was in libc's malloc. (This would have NetBSD 5 or 6.) I've fixed various issues in libc to make fork-without-exec reasonable reliable for many use cases. malloc certainly was one of them. Joerg