diff options
author | Subv <subv2112@gmail.com> | 2014-12-04 05:22:06 +0100 |
---|---|---|
committer | Subv <subv2112@gmail.com> | 2014-12-04 06:25:35 +0100 |
commit | 029ff9f1fd013ec46f3d61510c5f95f05bca698e (patch) | |
tree | 17177b27e64fa60c0c1847ba02e8ae187f0eebad /src/core/hle/kernel/thread.cpp | |
parent | Merge pull request #236 from rohit-n/sign-compare (diff) | |
download | yuzu-029ff9f1fd013ec46f3d61510c5f95f05bca698e.tar yuzu-029ff9f1fd013ec46f3d61510c5f95f05bca698e.tar.gz yuzu-029ff9f1fd013ec46f3d61510c5f95f05bca698e.tar.bz2 yuzu-029ff9f1fd013ec46f3d61510c5f95f05bca698e.tar.lz yuzu-029ff9f1fd013ec46f3d61510c5f95f05bca698e.tar.xz yuzu-029ff9f1fd013ec46f3d61510c5f95f05bca698e.tar.zst yuzu-029ff9f1fd013ec46f3d61510c5f95f05bca698e.zip |
Diffstat (limited to 'src/core/hle/kernel/thread.cpp')
-rw-r--r-- | src/core/hle/kernel/thread.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index f59795901..6da238828 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -49,6 +49,8 @@ public: ThreadContext context; + u32 thread_id; + u32 status; u32 entry_point; u32 stack_top; @@ -325,6 +327,9 @@ Thread* CreateThread(Handle& handle, const char* name, u32 entry_point, s32 prio thread_queue.push_back(handle); thread_ready_queue.prepare(priority); + // TODO(Subv): Assign valid ids to each thread, they are much lower than handle values + // they appear to begin at 276 and continue from there + thread->thread_id = handle; thread->status = THREADSTATUS_DORMANT; thread->entry_point = entry_point; thread->stack_top = stack_top; @@ -465,6 +470,17 @@ void Reschedule() { } } +ResultCode GetThreadId(u32* thread_id, Handle handle) { + Thread* thread = g_object_pool.Get<Thread>(handle); + if (thread == nullptr) + return ResultCode(ErrorDescription::InvalidHandle, ErrorModule::OS, + ErrorSummary::WrongArgument, ErrorLevel::Permanent); + + *thread_id = thread->thread_id; + + return RESULT_SUCCESS; +} + //////////////////////////////////////////////////////////////////////////////////////////////////// void ThreadingInit() { |