summaryrefslogtreecommitdiff
path: root/storage/innobase/sync
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-02-18 15:13:56 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2022-02-18 15:13:56 +0200
commit4030a9fb2eb699361c58d71878e97b282647319a (patch)
tree5d3b5b4e4dd38375cfd2cc7fde79adddc77c0945 /storage/innobase/sync
parentf04b459fb75b28dd57c7f22bc69588f087956373 (diff)
downloadmariadb-git-4030a9fb2eb699361c58d71878e97b282647319a.tar.gz
MDEV-26476: Implement futex for FreeBSD, DragonFly BSD
Diffstat (limited to 'storage/innobase/sync')
-rw-r--r--storage/innobase/sync/srw_lock.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/storage/innobase/sync/srw_lock.cc b/storage/innobase/sync/srw_lock.cc
index 71414e8ddb2..f406b04712a 100644
--- a/storage/innobase/sync/srw_lock.cc
+++ b/storage/innobase/sync/srw_lock.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2020, 2021, MariaDB Corporation.
+Copyright (c) 2020, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -339,6 +339,17 @@ void ssux_lock_impl<spinloop>::wake() { WakeByAddressSingle(&readers); }
# include <sys/futex.h>
# define SRW_FUTEX(a,op,n) \
futex((volatile uint32_t*) a, FUTEX_ ## op, n, nullptr, nullptr)
+# elif defined __FreeBSD__
+# include <sys/types.h>
+# include <sys/umtx.h>
+# define FUTEX_WAKE UMTX_OP_WAKE_PRIVATE
+# define FUTEX_WAIT UMTX_OP_WAIT_UINT_PRIVATE
+# define SRW_FUTEX(a,op,n) _umtx_op(a, FUTEX_ ## op, n, nullptr, nullptr)
+# elif defined __DragonFly__
+# include <unistd.h>
+# define FUTEX_WAKE(a,n) umtx_wakeup(a,n)
+# define FUTEX_WAIT(a,n) umtx_sleep(a,n,0)
+# define SRW_FUTEX(a,op,n) FUTEX_ ## op((volatile int*) a, int(n))
# else
# error "no futex support"
# endif