dolphin/Source/Android/jni/Host.h
JosJuice 068947e2b6 Core: Remove IsHostThread
The core no longer cares which thread is the host thread.

Cleaning up Android's HostThreadLock is left for another PR, in part
because the HostThreadLock in NativeConfig.cpp still serves a purpose,
and in part to make any issues easier to bisect.
2025-11-10 21:14:56 +01:00

31 lines
876 B
C++

// Copyright 2023 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <mutex>
// The Core only supports using a single Host thread.
// If multiple threads want to call host functions then they need to queue
// sequentially for access.
// TODO: The above isn't true anymore, so we should get rid of this class.
struct HostThreadLock
{
explicit HostThreadLock() : m_lock(s_host_identity_mutex) {}
~HostThreadLock() = default;
HostThreadLock(const HostThreadLock& other) = delete;
HostThreadLock(HostThreadLock&& other) = delete;
HostThreadLock& operator=(const HostThreadLock& other) = delete;
HostThreadLock& operator=(HostThreadLock&& other) = delete;
void Lock() { m_lock.lock(); }
void Unlock() { m_lock.unlock(); }
private:
static std::mutex s_host_identity_mutex;
std::unique_lock<std::mutex> m_lock;
};