From ede79862fb77bbd6bb8bc2bfbf35eec5206ccb9d Mon Sep 17 00:00:00 2001 From: fincs Date: Sat, 27 Oct 2018 17:34:44 +0200 Subject: [PATCH] Add threadGetCurHandle --- nx/include/switch/kernel/thread.h | 6 ++++++ nx/source/kernel/thread.c | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/nx/include/switch/kernel/thread.h b/nx/include/switch/kernel/thread.h index 4a858f6c..2b6c488c 100644 --- a/nx/include/switch/kernel/thread.h +++ b/nx/include/switch/kernel/thread.h @@ -73,3 +73,9 @@ Result threadResume(Thread* t); * @warning Official kernel will not dump x0..x18 if the thread is currently executing a system call, and prior to 6.0.0 doesn't dump TPIDR_EL0. */ Result threadDumpContext(ThreadContext* ctx, Thread* t); + +/** + * @brief Gets the raw handle to the current thread. + * @return The current thread's handle. + */ +Handle threadGetCurHandle(void); diff --git a/nx/source/kernel/thread.c b/nx/source/kernel/thread.c index dabb039d..74c1380a 100644 --- a/nx/source/kernel/thread.c +++ b/nx/source/kernel/thread.c @@ -138,3 +138,7 @@ Result threadResume(Thread* t) { Result threadDumpContext(ThreadContext* ctx, Thread* t) { return svcGetThreadContext3(ctx, t->handle); } + +Handle threadGetCurHandle(void) { + return getThreadVars()->handle; +}