/
githubmirror
/
yuzu
Обзор
Документация
Войти
/
githubmirror
/
yuzu
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/common/spin_lock.h
33 строки
706 B
Morph
general: Convert source file copyright comments over to SPDX
23 апр 2022, 12:55
23 апр 2022, 12:55
99ceb03
Код
Авторство
О чём код?
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #pragma once #include <atomic> namespace Common { /** * SpinLock class * a lock similar to mutex that forces a thread to spin wait instead calling the * supervisor. Should be used on short sequences of code. */ class SpinLock { public: SpinLock() = default; SpinLock(const SpinLock&) = delete; SpinLock& operator=(const SpinLock&) = delete; SpinLock(SpinLock&&) = delete; SpinLock& operator=(SpinLock&&) = delete; void lock(); void unlock(); [[nodiscard]] bool try_lock(); private: std::atomic_flag lck = ATOMIC_FLAG_INIT; }; } // namespace Common