aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/mutex.h
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2018-02-19 00:38:14 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2018-02-19 00:38:14 +0000
commitd2576988336db94d7382709bdf818467d4020b92 (patch)
tree57eb5ad2a86c0f16980f9bf9d5bbb43d6815fe33 /sys/sys/mutex.h
parent747de77cd52b0f79354e54432f4bb2d47115ca67 (diff)
downloadsrc-d2576988336db94d7382709bdf818467d4020b92.tar.gz
src-d2576988336db94d7382709bdf818467d4020b92.zip
mtx: add mtx_spin_wait_unlocked
The primitive can be used to wait for the lock to be released. Intended usage is for locks in structures which are about to be freed. The benefit is the avoided interrupt enable/disable trip + atomic op to grab the lock and shorter wait if the lock is held (since there is no worry someone will contend on the lock, re-reads can be more aggressive). Briefly discussed with: kib
Notes
Notes: svn path=/head/; revision=329540
Diffstat (limited to 'sys/sys/mutex.h')
-rw-r--r--sys/sys/mutex.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/sys/mutex.h b/sys/sys/mutex.h
index 805df8adc40a..f9ce4e3bdca7 100644
--- a/sys/sys/mutex.h
+++ b/sys/sys/mutex.h
@@ -125,6 +125,8 @@ int __mtx_trylock_spin_flags(volatile uintptr_t *c, int opts,
const char *file, int line);
void __mtx_unlock_spin_flags(volatile uintptr_t *c, int opts,
const char *file, int line);
+void mtx_spin_wait_unlocked(struct mtx *m);
+
#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
void __mtx_assert(const volatile uintptr_t *c, int what, const char *file,
int line);