File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed
Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,6 @@ function trylock end
2222function islocked end
2323unlockall (l:: AbstractLock ) = unlock (l) # internal function for implementing `wait`
2424relockall (l:: AbstractLock , token:: Nothing ) = lock (l) # internal function for implementing `wait`
25- assert_havelock (l:: AbstractLock ) = assert_havelock (l, Threads. threadid ())
2625assert_havelock (l:: AbstractLock , tid:: Integer ) =
2726 (islocked (l) && tid == Threads. threadid ()) ? nothing : concurrency_violation ()
2827assert_havelock (l:: AbstractLock , tid:: Task ) =
Original file line number Diff line number Diff line change @@ -30,6 +30,10 @@ struct SpinLock <: AbstractLock
3030 SpinLock () = new (Atomic {Int} (0 ))
3131end
3232
33+ # Note: this cannot assert that the lock is held by the correct thread, because we do not
34+ # track which thread locked it. Users beware.
35+ Base. assert_havelock (l:: SpinLock ) = islocked (l) ? nothing : concurrency_violation ()
36+
3337function lock (l:: SpinLock )
3438 while true
3539 if l. handle[] == 0
You can’t perform that action at this time.
0 commit comments