mirror of
https://github.com/PabloMK7/citra.git
synced 2024-11-17 04:17:15 +01:00
kernel/thread: Include thread-related enums within the kernel namespace
Previously, these were sitting outside of the Kernel namespace, which doesn't really make sense, given they're related to the Thread class which is within the Kernel namespace.
This commit is contained in:
parent
5dfa7b74b5
commit
ca3d9d659e
@ -145,32 +145,32 @@ QString WaitTreeThread::GetText() const {
|
|||||||
const auto& thread = static_cast<const Kernel::Thread&>(object);
|
const auto& thread = static_cast<const Kernel::Thread&>(object);
|
||||||
QString status;
|
QString status;
|
||||||
switch (thread.status) {
|
switch (thread.status) {
|
||||||
case ThreadStatus::Running:
|
case Kernel::ThreadStatus::Running:
|
||||||
status = tr("running");
|
status = tr("running");
|
||||||
break;
|
break;
|
||||||
case ThreadStatus::Ready:
|
case Kernel::ThreadStatus::Ready:
|
||||||
status = tr("ready");
|
status = tr("ready");
|
||||||
break;
|
break;
|
||||||
case ThreadStatus::WaitArb:
|
case Kernel::ThreadStatus::WaitArb:
|
||||||
status = tr("waiting for address 0x%1").arg(thread.wait_address, 8, 16, QLatin1Char('0'));
|
status = tr("waiting for address 0x%1").arg(thread.wait_address, 8, 16, QLatin1Char('0'));
|
||||||
break;
|
break;
|
||||||
case ThreadStatus::WaitSleep:
|
case Kernel::ThreadStatus::WaitSleep:
|
||||||
status = tr("sleeping");
|
status = tr("sleeping");
|
||||||
break;
|
break;
|
||||||
case ThreadStatus::WaitIPC:
|
case Kernel::ThreadStatus::WaitIPC:
|
||||||
status = tr("waiting for IPC response");
|
status = tr("waiting for IPC response");
|
||||||
break;
|
break;
|
||||||
case ThreadStatus::WaitSynchAll:
|
case Kernel::ThreadStatus::WaitSynchAll:
|
||||||
case ThreadStatus::WaitSynchAny:
|
case Kernel::ThreadStatus::WaitSynchAny:
|
||||||
status = tr("waiting for objects");
|
status = tr("waiting for objects");
|
||||||
break;
|
break;
|
||||||
case ThreadStatus::WaitHleEvent:
|
case Kernel::ThreadStatus::WaitHleEvent:
|
||||||
status = tr("waiting for HLE return");
|
status = tr("waiting for HLE return");
|
||||||
break;
|
break;
|
||||||
case ThreadStatus::Dormant:
|
case Kernel::ThreadStatus::Dormant:
|
||||||
status = tr("dormant");
|
status = tr("dormant");
|
||||||
break;
|
break;
|
||||||
case ThreadStatus::Dead:
|
case Kernel::ThreadStatus::Dead:
|
||||||
status = tr("dead");
|
status = tr("dead");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -183,23 +183,23 @@ QString WaitTreeThread::GetText() const {
|
|||||||
QColor WaitTreeThread::GetColor() const {
|
QColor WaitTreeThread::GetColor() const {
|
||||||
const auto& thread = static_cast<const Kernel::Thread&>(object);
|
const auto& thread = static_cast<const Kernel::Thread&>(object);
|
||||||
switch (thread.status) {
|
switch (thread.status) {
|
||||||
case ThreadStatus::Running:
|
case Kernel::ThreadStatus::Running:
|
||||||
return QColor(Qt::GlobalColor::darkGreen);
|
return QColor(Qt::GlobalColor::darkGreen);
|
||||||
case ThreadStatus::Ready:
|
case Kernel::ThreadStatus::Ready:
|
||||||
return QColor(Qt::GlobalColor::darkBlue);
|
return QColor(Qt::GlobalColor::darkBlue);
|
||||||
case ThreadStatus::WaitArb:
|
case Kernel::ThreadStatus::WaitArb:
|
||||||
return QColor(Qt::GlobalColor::darkRed);
|
return QColor(Qt::GlobalColor::darkRed);
|
||||||
case ThreadStatus::WaitSleep:
|
case Kernel::ThreadStatus::WaitSleep:
|
||||||
return QColor(Qt::GlobalColor::darkYellow);
|
return QColor(Qt::GlobalColor::darkYellow);
|
||||||
case ThreadStatus::WaitIPC:
|
case Kernel::ThreadStatus::WaitIPC:
|
||||||
return QColor(Qt::GlobalColor::darkCyan);
|
return QColor(Qt::GlobalColor::darkCyan);
|
||||||
case ThreadStatus::WaitSynchAll:
|
case Kernel::ThreadStatus::WaitSynchAll:
|
||||||
case ThreadStatus::WaitSynchAny:
|
case Kernel::ThreadStatus::WaitSynchAny:
|
||||||
case ThreadStatus::WaitHleEvent:
|
case Kernel::ThreadStatus::WaitHleEvent:
|
||||||
return QColor(Qt::GlobalColor::red);
|
return QColor(Qt::GlobalColor::red);
|
||||||
case ThreadStatus::Dormant:
|
case Kernel::ThreadStatus::Dormant:
|
||||||
return QColor(Qt::GlobalColor::darkCyan);
|
return QColor(Qt::GlobalColor::darkCyan);
|
||||||
case ThreadStatus::Dead:
|
case Kernel::ThreadStatus::Dead:
|
||||||
return QColor(Qt::GlobalColor::gray);
|
return QColor(Qt::GlobalColor::gray);
|
||||||
default:
|
default:
|
||||||
return WaitTreeItem::GetColor();
|
return WaitTreeItem::GetColor();
|
||||||
@ -213,16 +213,16 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThread::GetChildren() const {
|
|||||||
|
|
||||||
QString processor;
|
QString processor;
|
||||||
switch (thread.processor_id) {
|
switch (thread.processor_id) {
|
||||||
case ThreadProcessorId::THREADPROCESSORID_DEFAULT:
|
case Kernel::ThreadProcessorId::THREADPROCESSORID_DEFAULT:
|
||||||
processor = tr("default");
|
processor = tr("default");
|
||||||
break;
|
break;
|
||||||
case ThreadProcessorId::THREADPROCESSORID_ALL:
|
case Kernel::ThreadProcessorId::THREADPROCESSORID_ALL:
|
||||||
processor = tr("all");
|
processor = tr("all");
|
||||||
break;
|
break;
|
||||||
case ThreadProcessorId::THREADPROCESSORID_0:
|
case Kernel::ThreadProcessorId::THREADPROCESSORID_0:
|
||||||
processor = tr("AppCore");
|
processor = tr("AppCore");
|
||||||
break;
|
break;
|
||||||
case ThreadProcessorId::THREADPROCESSORID_1:
|
case Kernel::ThreadProcessorId::THREADPROCESSORID_1:
|
||||||
processor = tr("SysCore");
|
processor = tr("SysCore");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -243,9 +243,9 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThread::GetChildren() const {
|
|||||||
} else {
|
} else {
|
||||||
list.push_back(std::make_unique<WaitTreeMutexList>(thread.held_mutexes));
|
list.push_back(std::make_unique<WaitTreeMutexList>(thread.held_mutexes));
|
||||||
}
|
}
|
||||||
if (thread.status == ThreadStatus::WaitSynchAny ||
|
if (thread.status == Kernel::ThreadStatus::WaitSynchAny ||
|
||||||
thread.status == ThreadStatus::WaitSynchAll ||
|
thread.status == Kernel::ThreadStatus::WaitSynchAll ||
|
||||||
thread.status == ThreadStatus::WaitHleEvent) {
|
thread.status == Kernel::ThreadStatus::WaitHleEvent) {
|
||||||
list.push_back(std::make_unique<WaitTreeObjectList>(thread.wait_objects,
|
list.push_back(std::make_unique<WaitTreeObjectList>(thread.wait_objects,
|
||||||
thread.IsSleepingOnWaitAll()));
|
thread.IsSleepingOnWaitAll()));
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,11 @@
|
|||||||
#include "core/hle/kernel/wait_object.h"
|
#include "core/hle/kernel/wait_object.h"
|
||||||
#include "core/hle/result.h"
|
#include "core/hle/result.h"
|
||||||
|
|
||||||
|
namespace Kernel {
|
||||||
|
|
||||||
|
class Mutex;
|
||||||
|
class Process;
|
||||||
|
|
||||||
enum ThreadPriority : u32 {
|
enum ThreadPriority : u32 {
|
||||||
THREADPRIO_HIGHEST = 0, ///< Highest thread priority
|
THREADPRIO_HIGHEST = 0, ///< Highest thread priority
|
||||||
THREADPRIO_USERLAND_MAX = 24, ///< Highest thread priority for userland apps
|
THREADPRIO_USERLAND_MAX = 24, ///< Highest thread priority for userland apps
|
||||||
@ -48,11 +53,6 @@ enum class ThreadWakeupReason {
|
|||||||
Timeout // The thread was woken up due to a wait timeout.
|
Timeout // The thread was woken up due to a wait timeout.
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace Kernel {
|
|
||||||
|
|
||||||
class Mutex;
|
|
||||||
class Process;
|
|
||||||
|
|
||||||
class Thread final : public WaitObject {
|
class Thread final : public WaitObject {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -108,7 +108,7 @@ void File::Read(Kernel::HLERequestContext& ctx) {
|
|||||||
std::chrono::nanoseconds read_timeout_ns{backend->GetReadDelayNs(length)};
|
std::chrono::nanoseconds read_timeout_ns{backend->GetReadDelayNs(length)};
|
||||||
ctx.SleepClientThread(Kernel::GetCurrentThread(), "file::read", read_timeout_ns,
|
ctx.SleepClientThread(Kernel::GetCurrentThread(), "file::read", read_timeout_ns,
|
||||||
[](Kernel::SharedPtr<Kernel::Thread> thread,
|
[](Kernel::SharedPtr<Kernel::Thread> thread,
|
||||||
Kernel::HLERequestContext& ctx, ThreadWakeupReason reason) {
|
Kernel::HLERequestContext& ctx, Kernel::ThreadWakeupReason reason) {
|
||||||
// Nothing to do here
|
// Nothing to do here
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1162,7 +1162,7 @@ void NWM_UDS::ConnectToNetwork(Kernel::HLERequestContext& ctx) {
|
|||||||
connection_event = ctx.SleepClientThread(
|
connection_event = ctx.SleepClientThread(
|
||||||
Kernel::GetCurrentThread(), "uds::ConnectToNetwork", UDSConnectionTimeout,
|
Kernel::GetCurrentThread(), "uds::ConnectToNetwork", UDSConnectionTimeout,
|
||||||
[](Kernel::SharedPtr<Kernel::Thread> thread, Kernel::HLERequestContext& ctx,
|
[](Kernel::SharedPtr<Kernel::Thread> thread, Kernel::HLERequestContext& ctx,
|
||||||
ThreadWakeupReason reason) {
|
Kernel::ThreadWakeupReason reason) {
|
||||||
// TODO(B3N30): Add error handling for host full and timeout
|
// TODO(B3N30): Add error handling for host full and timeout
|
||||||
IPC::RequestBuilder rb(ctx, 0x1E, 1, 0);
|
IPC::RequestBuilder rb(ctx, 0x1E, 1, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
@ -198,11 +198,12 @@ void ServiceFrameworkBase::HandleSyncRequest(SharedPtr<ServerSession> server_ses
|
|||||||
handler_invoker(this, info->handler_callback, context);
|
handler_invoker(this, info->handler_callback, context);
|
||||||
|
|
||||||
auto thread = Kernel::GetCurrentThread();
|
auto thread = Kernel::GetCurrentThread();
|
||||||
ASSERT(thread->status == ThreadStatus::Running || thread->status == ThreadStatus::WaitHleEvent);
|
ASSERT(thread->status == Kernel::ThreadStatus::Running ||
|
||||||
|
thread->status == Kernel::ThreadStatus::WaitHleEvent);
|
||||||
// Only write the response immediately if the thread is still running. If the HLE handler put
|
// Only write the response immediately if the thread is still running. If the HLE handler put
|
||||||
// the thread to sleep then the writing of the command buffer will be deferred to the wakeup
|
// the thread to sleep then the writing of the command buffer will be deferred to the wakeup
|
||||||
// callback.
|
// callback.
|
||||||
if (thread->status == ThreadStatus::Running) {
|
if (thread->status == Kernel::ThreadStatus::Running) {
|
||||||
context.WriteToOutgoingCommandBuffer(cmd_buf, *Kernel::g_current_process,
|
context.WriteToOutgoingCommandBuffer(cmd_buf, *Kernel::g_current_process,
|
||||||
Kernel::g_handle_table);
|
Kernel::g_handle_table);
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,8 @@ void SRV::GetServiceHandle(Kernel::HLERequestContext& ctx) {
|
|||||||
// TODO(yuriks): Permission checks go here
|
// TODO(yuriks): Permission checks go here
|
||||||
|
|
||||||
auto get_handle = [name, this](Kernel::SharedPtr<Kernel::Thread> thread,
|
auto get_handle = [name, this](Kernel::SharedPtr<Kernel::Thread> thread,
|
||||||
Kernel::HLERequestContext& ctx, ThreadWakeupReason reason) {
|
Kernel::HLERequestContext& ctx,
|
||||||
|
Kernel::ThreadWakeupReason reason) {
|
||||||
LOG_ERROR(Service_SRV, "called service={} wakeup", name);
|
LOG_ERROR(Service_SRV, "called service={} wakeup", name);
|
||||||
auto client_port = service_manager->GetServicePort(name);
|
auto client_port = service_manager->GetServicePort(name);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user