diff options
author | Samuel Holland <samuel@sholland.org> | 2018-01-14 21:45:46 -0600 |
---|---|---|
committer | Samuel Holland <samuel@sholland.org> | 2018-01-14 21:46:47 -0600 |
commit | 18ce7cc13e00f98e214c211b55669e8dd4b3268c (patch) | |
tree | ccfda7d3b5520659826f04049bcb58d962627552 | |
parent | ea0bbb48b37dc43c3a1cec4e87ed7049e13b4ff9 (diff) | |
download | gcompat-18ce7cc13e00f98e214c211b55669e8dd4b3268c.tar.gz gcompat-18ce7cc13e00f98e214c211b55669e8dd4b3268c.tar.bz2 gcompat-18ce7cc13e00f98e214c211b55669e8dd4b3268c.tar.xz gcompat-18ce7cc13e00f98e214c211b55669e8dd4b3268c.zip |
pthread: Clean up, fix prototype
* Add the missing parameter to __register_atfork.
* Sort and document functions.
__pthread_register_cancel and __pthread_unregister_cancel should be
implemented at some point, or else pthread_cleanup_pop(true) will not
work properly and could cause deadlocks in programs that use it.
Signed-off-by: Samuel Holland <samuel@sholland.org>
-rw-r--r-- | libgcompat/pthread.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/libgcompat/pthread.c b/libgcompat/pthread.c index 9333554..4ebbe6b 100644 --- a/libgcompat/pthread.c +++ b/libgcompat/pthread.c @@ -2,17 +2,28 @@ #include "alias.h" /* weak_alias */ -int __register_atfork(void (*prepare)(void), void (*parent)(void), - void (*child)(void)) +/** + * Underlying function for pthread_cleanup_push. + */ +void __pthread_register_cancel(void *buf) { - return pthread_atfork(prepare, parent, child); } -weak_alias(__register_atfork, register_atfork); -void __pthread_register_cancel(void *buf) +/** + * Underlying function for pthread_cleanup_push. + */ +void __pthread_unregister_cancel(void *buf) { } -void __pthread_unregister_cancel(void *buf) +/** + * Register fork handlers. + * + * LSB 5.0: LSB-Core-generic/baselib---register-atfork.html + */ +int __register_atfork(void (*prepare)(void), void (*parent)(void), + void (*child)(void), void *__dso_handle) { + return pthread_atfork(prepare, parent, child); } +weak_alias(__register_atfork, register_atfork); |