diff options
| author | 2019-03-20 18:53:48 -0400 | |
|---|---|---|
| committer | 2019-04-02 00:48:40 -0400 | |
| commit | 28719ee3b4884d182126bddf639e1711b0744b22 (patch) | |
| tree | 3c8f4310e23117c330979c2c149d24a82104f04c /src/core/hle/kernel/process.h | |
| parent | kernel/svc: Implement svcGetProcessList (diff) | |
| download | yuzu-28719ee3b4884d182126bddf639e1711b0744b22.tar.gz yuzu-28719ee3b4884d182126bddf639e1711b0744b22.tar.xz yuzu-28719ee3b4884d182126bddf639e1711b0744b22.zip | |
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.
Diffstat (limited to 'src/core/hle/kernel/process.h')
| -rw-r--r-- | src/core/hle/kernel/process.h | 17 |
1 files changed, 17 insertions, 0 deletions
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 @@ | |||
| 7 | #include <array> | 7 | #include <array> |
| 8 | #include <bitset> | 8 | #include <bitset> |
| 9 | #include <cstddef> | 9 | #include <cstddef> |
| 10 | #include <list> | ||
| 10 | #include <string> | 11 | #include <string> |
| 11 | #include <vector> | 12 | #include <vector> |
| 12 | #include <boost/container/static_vector.hpp> | 13 | #include <boost/container/static_vector.hpp> |
| @@ -189,6 +190,19 @@ public: | |||
| 189 | /// Retrieves the total physical memory used by this process in bytes. | 190 | /// Retrieves the total physical memory used by this process in bytes. |
| 190 | u64 GetTotalPhysicalMemoryUsed() const; | 191 | u64 GetTotalPhysicalMemoryUsed() const; |
| 191 | 192 | ||
| 193 | /// Gets the list of all threads created with this process as their owner. | ||
| 194 | const std::list<const Thread*>& GetThreadList() const { | ||
| 195 | return thread_list; | ||
| 196 | } | ||
| 197 | |||
| 198 | /// Registers a thread as being created under this process, | ||
| 199 | /// adding it to this process' thread list. | ||
| 200 | void RegisterThread(const Thread* thread); | ||
| 201 | |||
| 202 | /// Unregisters a thread from this process, removing it | ||
| 203 | /// from this process' thread list. | ||
| 204 | void UnregisterThread(const Thread* thread); | ||
| 205 | |||
| 192 | /// Clears the signaled state of the process if and only if it's signaled. | 206 | /// Clears the signaled state of the process if and only if it's signaled. |
| 193 | /// | 207 | /// |
| 194 | /// @pre The process must not be already terminated. If this is called on a | 208 | /// @pre The process must not be already terminated. If this is called on a |
| @@ -308,6 +322,9 @@ private: | |||
| 308 | /// Random values for svcGetInfo RandomEntropy | 322 | /// Random values for svcGetInfo RandomEntropy |
| 309 | std::array<u64, RANDOM_ENTROPY_SIZE> random_entropy; | 323 | std::array<u64, RANDOM_ENTROPY_SIZE> random_entropy; |
| 310 | 324 | ||
| 325 | /// List of threads that are running with this process as their owner. | ||
| 326 | std::list<const Thread*> thread_list; | ||
| 327 | |||
| 311 | /// System context | 328 | /// System context |
| 312 | Core::System& system; | 329 | Core::System& system; |
| 313 | 330 | ||