summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/process.h
diff options
context:
space:
mode:
authorGravatar Lioncash2018-12-04 19:08:56 -0500
committerGravatar Lioncash2018-12-04 20:14:59 -0500
commitc7462ce71241fe6c8dfee48a859c63a6b1fd84fb (patch)
tree0350cdf3dcb0cae57573b7b2d869875c16f9b840 /src/core/hle/kernel/process.h
parentkernel/readable_event: Add member function for enforcing a strict reset contract (diff)
downloadyuzu-c7462ce71241fe6c8dfee48a859c63a6b1fd84fb.tar.gz
yuzu-c7462ce71241fe6c8dfee48a859c63a6b1fd84fb.tar.xz
yuzu-c7462ce71241fe6c8dfee48a859c63a6b1fd84fb.zip
kernel/process: Make Process a WaitObject
Process instances can be waited upon for state changes. This is also utilized by svcResetSignal, which will be modified in an upcoming change. This simply puts all of the WaitObject related machinery in place.
Diffstat (limited to 'src/core/hle/kernel/process.h')
-rw-r--r--src/core/hle/kernel/process.h30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h
index 49345aa66..bcb9ac4b8 100644
--- a/src/core/hle/kernel/process.h
+++ b/src/core/hle/kernel/process.h
@@ -14,9 +14,10 @@
14#include "common/bit_field.h" 14#include "common/bit_field.h"
15#include "common/common_types.h" 15#include "common/common_types.h"
16#include "core/hle/kernel/handle_table.h" 16#include "core/hle/kernel/handle_table.h"
17#include "core/hle/kernel/object.h"
18#include "core/hle/kernel/thread.h" 17#include "core/hle/kernel/thread.h"
19#include "core/hle/kernel/vm_manager.h" 18#include "core/hle/kernel/vm_manager.h"
19#include "core/hle/kernel/wait_object.h"
20#include "core/hle/result.h"
20 21
21namespace FileSys { 22namespace FileSys {
22class ProgramMetadata; 23class ProgramMetadata;
@@ -117,7 +118,7 @@ struct CodeSet final {
117 VAddr entrypoint = 0; 118 VAddr entrypoint = 0;
118}; 119};
119 120
120class Process final : public Object { 121class Process final : public WaitObject {
121public: 122public:
122 static constexpr std::size_t RANDOM_ENTROPY_SIZE = 4; 123 static constexpr std::size_t RANDOM_ENTROPY_SIZE = 4;
123 124
@@ -212,6 +213,16 @@ public:
212 return random_entropy.at(index); 213 return random_entropy.at(index);
213 } 214 }
214 215
216 /// Clears the signaled state of the process if and only if it's signaled.
217 ///
218 /// @pre The process must not be already terminated. If this is called on a
219 /// terminated process, then ERR_INVALID_STATE will be returned.
220 ///
221 /// @pre The process must be in a signaled state. If this is called on a
222 /// process instance that is not signaled, ERR_INVALID_STATE will be
223 /// returned.
224 ResultCode ClearSignalState();
225
215 /** 226 /**
216 * Loads process-specifics configuration info with metadata provided 227 * Loads process-specifics configuration info with metadata provided
217 * by an executable. 228 * by an executable.
@@ -260,6 +271,17 @@ private:
260 explicit Process(KernelCore& kernel); 271 explicit Process(KernelCore& kernel);
261 ~Process() override; 272 ~Process() override;
262 273
274 /// Checks if the specified thread should wait until this process is available.
275 bool ShouldWait(Thread* thread) const override;
276
277 /// Acquires/locks this process for the specified thread if it's available.
278 void Acquire(Thread* thread) override;
279
280 /// Changes the process status. If the status is different
281 /// from the current process status, then this will trigger
282 /// a process signal.
283 void ChangeStatus(ProcessStatus new_status);
284
263 /// Memory manager for this process. 285 /// Memory manager for this process.
264 Kernel::VMManager vm_manager; 286 Kernel::VMManager vm_manager;
265 287
@@ -305,6 +327,10 @@ private:
305 /// specified by metadata provided to the process during loading. 327 /// specified by metadata provided to the process during loading.
306 bool is_64bit_process = true; 328 bool is_64bit_process = true;
307 329
330 /// Whether or not this process is signaled. This occurs
331 /// upon the process changing to a different state.
332 bool is_signaled = false;
333
308 /// Total running time for the process in ticks. 334 /// Total running time for the process in ticks.
309 u64 total_process_running_time_ticks = 0; 335 u64 total_process_running_time_ticks = 0;
310 336