summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorStuart Henderson <sthen@cvs.openbsd.org>2019-10-24 12:32:19 +0000
committerStuart Henderson <sthen@cvs.openbsd.org>2019-10-24 12:32:19 +0000
commitef969a1179b8f10963a76cbdb8170999ac848f7f (patch)
tree200ee7d13f72013e69659d01d3ca21a34f6bd65d /lib
parent2ebdf5d2d777397bd9bb79699917775e82a2e218 (diff)
Backout previous synch.h commit (r1.5, "Use process-private futexes to avoid
the uvm_map lookup overhead"). This causes hangs with Python, seen easily by trying to build ports/graphics/py-Pillow.
Diffstat (limited to 'lib')
-rw-r--r--lib/librthread/synch.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/librthread/synch.h b/lib/librthread/synch.h
index eee41d78e8b..381ed1b1749 100644
--- a/lib/librthread/synch.h
+++ b/lib/librthread/synch.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: synch.h,v 1.5 2019/10/21 10:06:31 mpi Exp $ */
+/* $OpenBSD: synch.h,v 1.6 2019/10/24 12:32:18 sthen Exp $ */
/*
* Copyright (c) 2017 Martin Pieuchot
*
@@ -22,7 +22,14 @@
static inline int
_wake(volatile uint32_t *p, int n)
{
- return futex(p, FUTEX_WAKE_PRIVATE, n, NULL, NULL);
+ return futex(p, FUTEX_WAKE, n, NULL, NULL);
+}
+
+static inline void
+_wait(volatile uint32_t *p, int val)
+{
+ while (*p != (uint32_t)val)
+ futex(p, FUTEX_WAIT, val, NULL, NULL);
}
static inline int
@@ -31,7 +38,7 @@ _twait(volatile uint32_t *p, int val, clockid_t clockid, const struct timespec *
struct timespec rel;
if (abs == NULL)
- return futex(p, FUTEX_WAIT_PRIVATE, val, NULL, NULL);
+ return futex(p, FUTEX_WAIT, val, NULL, NULL);
if (abs->tv_nsec >= 1000000000 || clock_gettime(clockid, &rel))
return (EINVAL);
@@ -44,11 +51,11 @@ _twait(volatile uint32_t *p, int val, clockid_t clockid, const struct timespec *
if (rel.tv_sec < 0)
return (ETIMEDOUT);
- return futex(p, FUTEX_WAIT_PRIVATE, val, &rel, NULL);
+ return futex(p, FUTEX_WAIT, val, &rel, NULL);
}
static inline int
_requeue(volatile uint32_t *p, int n, int m, volatile uint32_t *q)
{
- return futex(p, FUTEX_REQUEUE_PRIVATE, n, (void *)(long)m, q);
+ return futex(p, FUTEX_REQUEUE, n, (void *)(long)m, q);
}