This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Fork generation and pthread_once
- From: Florian Weimer <fweimer at redhat dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Tue, 20 Feb 2018 12:15:40 +0100
- Subject: Fork generation and pthread_once
- Authentication-results: sourceware.org; auth=none
Our pthread_once implementation has some logic in it to allow
pthread_once to re-run the initialization in the child process if a fork
has happened while the initialization executed in another thread.
Technically, this is compliant because pthread_once is not
async-signal-safe and thus is not allowed to be called after a fork.
But the whole thing still looks fairly broken to me because it is not
immediately obvious that restarting an arbitrary pthread_once
initialization is safe.
So do we really need the fork generation logic?
I feel like I have raised this before.
Thanks,
Florian