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/dbinc/mutex_int.h b/dbinc/mutex_int.h
21 --- a/dbinc/mutex_int.h 1969-12-31 19:00:01.000000000 -0500
22 +++ b/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; })
43 diff -ur a/dbinc/mutex_int.h b/dbinc/mutex_int.h
44 --- a/dbinc_auto/mutex_ext.h 1969-12-31 19:00:01.000000000 -0500
45 +++ b/dbinc_auto/mutex_ext.h 2023-07-01 22:38:20.749201366 -0400
47 #if !defined(HAVE_ATOMIC_SUPPORT) && defined(HAVE_MUTEX_SUPPORT)
48 atomic_value_t __atomic_dec __P((ENV *, db_atomic_t *));
50 +#if !defined(HAVE_ATOMIC_SUPPORT) && defined(HAVE_MUTEX_SUPPORT)
51 +int atomic_compare_exchange __P((ENV *, db_atomic_t *, atomic_value_t, atomic_value_t));
53 int __db_pthread_mutex_init __P((ENV *, db_mutex_t, u_int32_t));
54 int __db_pthread_mutex_lock __P((ENV *, db_mutex_t));
55 #if defined(HAVE_SHARED_LATCHES)