blob: ba2601e2b0d8e8be37ecce50319dffc40b572d23 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#include "hot_swap.h"
#include <util/system/spinlock.h>
namespace NHotSwapPrivate {
void TWriterLock::Acquire() noexcept {
++ReadersCount;
}
void TWriterLock::Release() noexcept {
--ReadersCount;
}
void TWriterLock::WaitAllReaders() const noexcept {
for (i32 cnt = ReadersCount.load(); cnt > 0;) {
SpinLockPause();
cnt = ReadersCount.load();
Y_ASSERT(cnt >= 0);
}
}
}
|