diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2024-10-20 15:21:43 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2024-10-20 15:21:43 +0200 |
commit | 4682deeb62247d34de87f8e777f99e2d337fd377 (patch) | |
tree | 5bd5b5605b5f3a4b3c8ea7468c34c23094afdef4 /lib/glthread/lock.c | |
parent | 00893e79fc62966067af1a106567db96bd170338 (diff) |
New upstream version 1.3upstream/1.3upstream
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 /* ========================================================================= */ |