nptl: Mention libstdc++ compatibility for pthread_once
Commit Message
---
nptl/pthread_once.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
Comments
* Florian Weimer via Libc-alpha:
> ---
> nptl/pthread_once.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/nptl/pthread_once.c b/nptl/pthread_once.c
> index 28d97097c7..702d1c0877 100644
> --- a/nptl/pthread_once.c
> +++ b/nptl/pthread_once.c
> @@ -61,7 +61,15 @@ clear_once_control (void *arg)
> interrupted cases anymore.
> XXX: We split out this slow path because current compilers do not generate
> as efficient code when the fast path in __pthread_once below is not in a
> - separate function. */
> + separate function.
> +
> + Compatibility note: The implementation of std::call_once in
> + libstdc++ before GCC 11 does not call pthread_once if the control
> + object has the value __PTHREAD_ONCE_DONE (2). libstdc++ starting
> + in GCC 11 uses the values 0 (uninitialized), 1 (in progress), 2
> + (done) for its own from-scratch implementation. These
> + implementations can operate on the same control object if libstdc++
> + is statically linked. */
> static int
> __attribute__ ((noinline))
> __pthread_once_slow (pthread_once_t *once_control, void (*init_routine) (void))
I'm dropping this patch, it's not correct and no longer relevant.
Thanks,
Florian
@@ -61,7 +61,15 @@ clear_once_control (void *arg)
interrupted cases anymore.
XXX: We split out this slow path because current compilers do not generate
as efficient code when the fast path in __pthread_once below is not in a
- separate function. */
+ separate function.
+
+ Compatibility note: The implementation of std::call_once in
+ libstdc++ before GCC 11 does not call pthread_once if the control
+ object has the value __PTHREAD_ONCE_DONE (2). libstdc++ starting
+ in GCC 11 uses the values 0 (uninitialized), 1 (in progress), 2
+ (done) for its own from-scratch implementation. These
+ implementations can operate on the same control object if libstdc++
+ is statically linked. */
static int
__attribute__ ((noinline))
__pthread_once_slow (pthread_once_t *once_control, void (*init_routine) (void))