diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2024-10-20 15:22:21 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2024-10-20 15:22:21 +0200 |
commit | 1d8b9e17ea13630aec475484da09ebba0366f7c8 (patch) | |
tree | 0c801f68561bfb0930a4ade80d7ca3a7940887ab /lib/glthread/lock.c | |
parent | 84e26c587987e8484d55db4165f188b40c09e94b (diff) | |
parent | 630f99f29bd31a76d8d24da2975a045452c763ef (diff) |
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'lib/glthread/lock.c')
-rw-r--r-- | lib/glthread/lock.c | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/lib/glthread/lock.c b/lib/glthread/lock.c index 6661ad6a..40b2a5ee 100644 --- a/lib/glthread/lock.c +++ b/lib/glthread/lock.c @@ -240,8 +240,6 @@ glthread_recursive_lock_destroy (gl_recursive_lock_t *lock) return 0; } -/* -------------------------- gl_once_t datatype -------------------------- */ - #endif /* ========================================================================= */ @@ -698,46 +696,6 @@ glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock) # endif -/* -------------------------- gl_once_t datatype -------------------------- */ - -static const pthread_once_t fresh_once = PTHREAD_ONCE_INIT; - -int -glthread_once_singlethreaded (pthread_once_t *once_control) -{ - /* We don't know whether pthread_once_t is an integer type, a floating-point - type, a pointer type, or a structure type. */ - char *firstbyte = (char *)once_control; - if (*firstbyte == *(const char *)&fresh_once) - { - /* First time use of once_control. Invert the first byte. */ - *firstbyte = ~ *(const char *)&fresh_once; - return 1; - } - else - return 0; -} - -# if !(PTHREAD_IN_USE_DETECTION_HARD || USE_POSIX_THREADS_WEAK) - -int -glthread_once_multithreaded (pthread_once_t *once_control, - void (*init_function) (void)) -{ - int err = pthread_once (once_control, init_function); - if (err == ENOSYS) - { - /* This happens on FreeBSD 11: The pthread_once function in libc returns - ENOSYS. */ - if (glthread_once_singlethreaded (once_control)) - init_function (); - return 0; - } - return err; -} - -# endif - #endif /* ========================================================================= */ |