1 diff -ur a/dist/aclocal/mutex.m4 b/dist/aclocal/mutex.m4
2 --- a/dist/aclocal/mutex.m4 1969-12-31 19:00:01.000000000 -0500
3 +++ b/dist/aclocal/mutex.m4 2023-06-05 19:14:47.214158196 -0400
6 # _spin_lock_try/_spin_unlock: Apple/Darwin
7 if test "$db_cv_mutex" = no; then
13 +#include <os/lock.h>],[
14 + os_unfair_lock x = OS_UNFAIR_LOCK_INIT;
15 + bool _ = os_unfair_lock_trylock(&x);
16 + os_unfair_lock_unlock(&x);
17 ], [db_cv_mutex=Darwin/_spin_lock_try])
20 diff -ur a/src/dbinc/mutex_int.h b/src/dbinc/mutex_int.h
21 --- a/src/dbinc/mutex_int.h 1969-12-31 19:00:01.000000000 -0500
22 +++ b/src/dbinc/mutex_int.h 2023-06-05 19:15:37.510514745 -0400
24 * Apple/Darwin library functions.
25 *********************************************************************/
26 #ifdef HAVE_MUTEX_DARWIN_SPIN_LOCK_TRY
27 -typedef u_int32_t tsl_t;
29 +typedef os_unfair_lock tsl_t;
31 #ifdef LOAD_ACTUAL_MUTEX_CODE
32 -extern int _spin_lock_try(tsl_t *);
33 -extern void _spin_unlock(tsl_t *);
34 -#define MUTEX_SET(tsl) _spin_lock_try(tsl)
35 -#define MUTEX_UNSET(tsl) _spin_unlock(tsl)
36 -#define MUTEX_INIT(tsl) (MUTEX_UNSET(tsl), 0)
37 +#define MUTEX_SET(tsl) os_unfair_lock_trylock(tsl)
38 +#define MUTEX_UNSET(tsl) os_unfair_lock_unlock(tsl)
39 +#define MUTEX_INIT(tsl) ({ *(tsl) = OS_UNFAIR_LOCK_INIT; tsl; })