comparison lib/glthread/lock.h @ 39246:ef22bb0a9591

lock: Fix test-once1 crash on FreeBSD11. * lib/glthread/lock.h: On FreeBSD, test the weak value of the symbol 'pthread_create', not 'pthread_cancel'.
author Bruno Haible <bruno@clisp.org>
date Sat, 17 Feb 2018 10:23:35 +0100
parents 24e347e0e326
children e852682b1886
comparison
equal deleted inserted replaced
39245:f6cb783d3822 39246:ef22bb0a9591
147 # ifndef pthread_self 147 # ifndef pthread_self
148 # pragma weak pthread_self 148 # pragma weak pthread_self
149 # endif 149 # endif
150 150
151 # if !PTHREAD_IN_USE_DETECTION_HARD 151 # if !PTHREAD_IN_USE_DETECTION_HARD
152 # pragma weak pthread_cancel 152 /* On most platforms, pthread_cancel or pthread_kill can be used to
153 # define pthread_in_use() (pthread_cancel != NULL) 153 determine whether libpthread is in use.
154 On newer versions of FreeBSD, however, this is no longer possible,
155 because pthread_cancel and pthread_kill got added to libc. Therefore
156 use pthread_create to test whether libpthread is in use. */
157 # if defined __FreeBSD__ || defined __DragonFly__ /* FreeBSD */
158 # pragma weak pthread_create
159 # define pthread_in_use() (pthread_create != NULL)
160 # else /* glibc, NetBSD, OpenBSD, IRIX, OSF/1, Solaris */
161 # pragma weak pthread_cancel
162 # define pthread_in_use() (pthread_cancel != NULL)
163 # endif
154 # endif 164 # endif
155 165
156 # else 166 # else
157 167
158 # if !PTHREAD_IN_USE_DETECTION_HARD 168 # if !PTHREAD_IN_USE_DETECTION_HARD