diff options
| author | 2020-12-15 00:41:48 -0800 | |
|---|---|---|
| committer | 2020-12-29 01:12:39 -0800 | |
| commit | dfdac7d38af170683812f3b474ef9d686dfa9ef8 (patch) | |
| tree | d72ff3fb593e6d42984b4d89863ae22cab3d77f5 /src/core/hle/kernel/kernel.h | |
| parent | hle: kernel: service_thread: Add thread name and take weak_ptr of ServerSession. (diff) | |
| download | yuzu-dfdac7d38af170683812f3b474ef9d686dfa9ef8.tar.gz yuzu-dfdac7d38af170683812f3b474ef9d686dfa9ef8.tar.xz yuzu-dfdac7d38af170683812f3b474ef9d686dfa9ef8.zip | |
hle: kernel: Move ServiceThread ownership to KernelCore.
- Fixes a circular dependency which prevented threads from being released on shutdown.
Diffstat (limited to 'src/core/hle/kernel/kernel.h')
| -rw-r--r-- | src/core/hle/kernel/kernel.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index 5846c3f39..e3169f5a7 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h | |||
| @@ -42,6 +42,7 @@ class Process; | |||
| 42 | class ResourceLimit; | 42 | class ResourceLimit; |
| 43 | class KScheduler; | 43 | class KScheduler; |
| 44 | class SharedMemory; | 44 | class SharedMemory; |
| 45 | class ServiceThread; | ||
| 45 | class Synchronization; | 46 | class Synchronization; |
| 46 | class Thread; | 47 | class Thread; |
| 47 | class TimeManager; | 48 | class TimeManager; |
| @@ -227,6 +228,22 @@ public: | |||
| 227 | 228 | ||
| 228 | void ExitSVCProfile(); | 229 | void ExitSVCProfile(); |
| 229 | 230 | ||
| 231 | /** | ||
| 232 | * Creates an HLE service thread, which are used to execute service routines asynchronously. | ||
| 233 | * While these are allocated per ServerSession, these need to be owned and managed outside of | ||
| 234 | * ServerSession to avoid a circular dependency. | ||
| 235 | * @param name String name for the ServerSession creating this thread, used for debug purposes. | ||
| 236 | * @returns The a weak pointer newly created service thread. | ||
| 237 | */ | ||
| 238 | std::weak_ptr<Kernel::ServiceThread> CreateServiceThread(const std::string& name); | ||
| 239 | |||
| 240 | /** | ||
| 241 | * Releases a HLE service thread, instructing KernelCore to free it. This should be called when | ||
| 242 | * the ServerSession associated with the thread is destroyed. | ||
| 243 | * @param service_thread Service thread to release. | ||
| 244 | */ | ||
| 245 | void ReleaseServiceThread(std::weak_ptr<Kernel::ServiceThread> service_thread); | ||
| 246 | |||
| 230 | private: | 247 | private: |
| 231 | friend class Object; | 248 | friend class Object; |
| 232 | friend class Process; | 249 | friend class Process; |