From 28719ee3b4884d182126bddf639e1711b0744b22 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 20 Mar 2019 18:53:48 -0400 Subject: kernel/svc: Implement svcGetThreadList Similarly like svcGetProcessList, this retrieves the list of threads from the current process. In the kernel itself, a process instance maintains a list of threads, which are used within this function. Threads are registered to a process' thread list at thread initialization, and unregistered from the list upon thread destruction (if said thread has a non-null owning process). We assert on the debug event case, as we currently don't implement kernel debug objects. --- src/core/hle/kernel/process.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/core/hle/kernel/process.h') diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h index 732d12170..f9ddc937c 100644 --- a/src/core/hle/kernel/process.h +++ b/src/core/hle/kernel/process.h @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -189,6 +190,19 @@ public: /// Retrieves the total physical memory used by this process in bytes. u64 GetTotalPhysicalMemoryUsed() const; + /// Gets the list of all threads created with this process as their owner. + const std::list& GetThreadList() const { + return thread_list; + } + + /// Registers a thread as being created under this process, + /// adding it to this process' thread list. + void RegisterThread(const Thread* thread); + + /// Unregisters a thread from this process, removing it + /// from this process' thread list. + void UnregisterThread(const Thread* thread); + /// Clears the signaled state of the process if and only if it's signaled. /// /// @pre The process must not be already terminated. If this is called on a @@ -308,6 +322,9 @@ private: /// Random values for svcGetInfo RandomEntropy std::array random_entropy; + /// List of threads that are running with this process as their owner. + std::list thread_list; + /// System context Core::System& system; -- cgit v1.2.3