Re: [PATCH] pthread_once and fork

2025-04-11 Thread Martin Husemann
On Sat, Apr 12, 2025 at 02:36:57AM +, Taylor R Campbell wrote: > Proposal: > >Make pthread_once mutually exclusive with fork -- mainly at the >cost of one leaf function call and two predicted-not-taken >conditional branches in fork, plus a little more private coupling >between

[PATCH] pthread_once and fork

2025-04-11 Thread Taylor R Campbell
tl;dr -- pthread_once can't satisfy its contract to call a function _once_ if concurrent fork is allowed, even though that would be useful, e.g. for lazy initialization of arc4random state. Proposal: Make pthread_once mutually exclusive with fork -- mainly at the cost of one leaf function c