diff options
author | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2014-12-22 07:32:03 +0100 |
---|---|---|
committer | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2015-01-09 06:51:55 +0100 |
commit | ba72208cd4905410eab8b996da0fa05fd05c72ff (patch) | |
tree | 3dcaf53894232e83741d3a524c7c53b8da60409c /src/core/hle/kernel/thread.cpp | |
parent | Move ThreadContext to core/core.h and deal with the fallout (diff) | |
download | yuzu-ba72208cd4905410eab8b996da0fa05fd05c72ff.tar yuzu-ba72208cd4905410eab8b996da0fa05fd05c72ff.tar.gz yuzu-ba72208cd4905410eab8b996da0fa05fd05c72ff.tar.bz2 yuzu-ba72208cd4905410eab8b996da0fa05fd05c72ff.tar.lz yuzu-ba72208cd4905410eab8b996da0fa05fd05c72ff.tar.xz yuzu-ba72208cd4905410eab8b996da0fa05fd05c72ff.tar.zst yuzu-ba72208cd4905410eab8b996da0fa05fd05c72ff.zip |
Diffstat (limited to 'src/core/hle/kernel/thread.cpp')
-rw-r--r-- | src/core/hle/kernel/thread.cpp | 60 |
1 files changed, 9 insertions, 51 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 3e9ea464d..ef63c5f41 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -22,60 +22,18 @@ namespace Kernel { -class Thread : public Kernel::Object { -public: - - std::string GetName() const override { return name; } - std::string GetTypeName() const override { return "Thread"; } - - static const HandleType HANDLE_TYPE = HandleType::Thread; - HandleType GetHandleType() const override { return HANDLE_TYPE; } - - inline bool IsRunning() const { return (status & THREADSTATUS_RUNNING) != 0; } - inline bool IsStopped() const { return (status & THREADSTATUS_DORMANT) != 0; } - inline bool IsReady() const { return (status & THREADSTATUS_READY) != 0; } - inline bool IsWaiting() const { return (status & THREADSTATUS_WAIT) != 0; } - inline bool IsSuspended() const { return (status & THREADSTATUS_SUSPEND) != 0; } - inline bool IsIdle() const { return idle; } - - ResultVal<bool> WaitSynchronization() override { - const bool wait = status != THREADSTATUS_DORMANT; - if (wait) { - Handle thread = GetCurrentThreadHandle(); - if (std::find(waiting_threads.begin(), waiting_threads.end(), thread) == waiting_threads.end()) { - waiting_threads.push_back(thread); - } - WaitCurrentThread(WAITTYPE_THREADEND, this->GetHandle()); +ResultVal<bool> Thread::WaitSynchronization() { + const bool wait = status != THREADSTATUS_DORMANT; + if (wait) { + Handle thread = GetCurrentThreadHandle(); + if (std::find(waiting_threads.begin(), waiting_threads.end(), thread) == waiting_threads.end()) { + waiting_threads.push_back(thread); } - - return MakeResult<bool>(wait); + WaitCurrentThread(WAITTYPE_THREADEND, this->GetHandle()); } - Core::ThreadContext context; - - u32 thread_id; - - u32 status; - u32 entry_point; - u32 stack_top; - u32 stack_size; - - s32 initial_priority; - s32 current_priority; - - s32 processor_id; - - WaitType wait_type; - Handle wait_handle; - VAddr wait_address; - - std::vector<Handle> waiting_threads; - - std::string name; - - /// Whether this thread is intended to never actually be executed, i.e. always idle - bool idle = false; -}; + return MakeResult<bool>(wait); +} // Lists all thread ids that aren't deleted/etc. static std::vector<Handle> thread_queue; |