Skip to content

Commit 068a0d0

Browse files
authored
[UR] Remove unused SpinLock (#19075)
1 parent ca9795a commit 068a0d0

File tree

1 file changed

+0
-21
lines changed
  • unified-runtime/source/ur

1 file changed

+0
-21
lines changed

unified-runtime/source/ur/ur.hpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)