Add more specific assertion for SpinLock initialization.
This commit is contained in:
parent
fc96ee9050
commit
b391ebabbe
|
@ -1023,6 +1023,7 @@ package struct SpinLock {
|
||||||
|
|
||||||
bool tryLock()
|
bool tryLock()
|
||||||
@trusted {
|
@trusted {
|
||||||
|
assert(threadID != 0, "SpinLock.setup() was not called.");
|
||||||
assert(atomicLoad(locked) != threadID, "Recursive lock attempt.");
|
assert(atomicLoad(locked) != threadID, "Recursive lock attempt.");
|
||||||
return cas(&locked, 0, threadID);
|
return cas(&locked, 0, threadID);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue