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/thread.cpp | |
| 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/thread.cpp')
| -rw-r--r-- | src/core/hle/kernel/thread.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index fa3ac3abc..3ec3710b2 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp | |||
| @@ -62,6 +62,8 @@ void Thread::Stop() { | |||
| 62 | } | 62 | } |
| 63 | wait_objects.clear(); | 63 | wait_objects.clear(); |
| 64 | 64 | ||
| 65 | owner_process->UnregisterThread(this); | ||
| 66 | |||
| 65 | // Mark the TLS slot in the thread's page as free. | 67 | // Mark the TLS slot in the thread's page as free. |
| 66 | owner_process->FreeTLSSlot(tls_address); | 68 | owner_process->FreeTLSSlot(tls_address); |
| 67 | } | 69 | } |
| @@ -202,6 +204,8 @@ ResultVal<SharedPtr<Thread>> Thread::Create(KernelCore& kernel, std::string name | |||
| 202 | thread->scheduler->AddThread(thread); | 204 | thread->scheduler->AddThread(thread); |
| 203 | thread->tls_address = thread->owner_process->MarkNextAvailableTLSSlotAsUsed(*thread); | 205 | thread->tls_address = thread->owner_process->MarkNextAvailableTLSSlotAsUsed(*thread); |
| 204 | 206 | ||
| 207 | thread->owner_process->RegisterThread(thread.get()); | ||
| 208 | |||
| 205 | // TODO(peachum): move to ScheduleThread() when scheduler is added so selected core is used | 209 | // TODO(peachum): move to ScheduleThread() when scheduler is added so selected core is used |
| 206 | // to initialize the context | 210 | // to initialize the context |
| 207 | ResetThreadContext(thread->context, stack_top, entry_point, arg); | 211 | ResetThreadContext(thread->context, stack_top, entry_point, arg); |