1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:38:12 +00:00

LibC+LibPthread: Permit partial pthread_atfork

POSIX explicitly allows providing nullptr's, and our __pthread_*() implementation
stores and calls the provided functions as-is, without checking for nullptr.
This commit is contained in:
Ben Wiederhake 2021-02-15 21:15:52 +01:00 committed by Andreas Kling
parent fbb85f9b2f
commit cf0d4994c2

View file

@ -900,9 +900,12 @@ int pthread_rwlockattr_setpshared(pthread_rwlockattr_t*, int)
int pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void))
{
__pthread_fork_atfork_register_prepare(prepare);
__pthread_fork_atfork_register_parent(parent);
__pthread_fork_atfork_register_child(child);
if (prepare)
__pthread_fork_atfork_register_prepare(prepare);
if (parent)
__pthread_fork_atfork_register_parent(parent);
if (child)
__pthread_fork_atfork_register_child(child);
return 0;
}