File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -185,27 +185,6 @@ class ur_lock {
185185 }
186186};
187187
188- // / SpinLock is a synchronization primitive, that uses atomic variable and
189- // / causes thread trying acquire lock wait in loop while repeatedly check if
190- // / the lock is available.
191- // /
192- // / One important feature of this implementation is that std::atomic<bool> can
193- // / be zero-initialized. This allows SpinLock to have trivial constructor and
194- // / destructor, which makes it possible to use it in global context (unlike
195- // / std::mutex, that doesn't provide such guarantees).
196- class SpinLock {
197- public:
198- void lock () {
199- while (MLock.test_and_set (std::memory_order_acquire)) {
200- std::this_thread::yield ();
201- }
202- }
203- void unlock () { MLock.clear (std::memory_order_release); }
204-
205- private:
206- std::atomic_flag MLock = ATOMIC_FLAG_INIT;
207- };
208-
209188// The wrapper for immutable data.
210189// The data is initialized only once at first access (via ->) with the
211190// initialization function provided in Init. All subsequent access to
You can’t perform that action at this time.
0 commit comments