summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/thread.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2014-05-20 18:20:35 -0400
committerGravatar bunnei2014-05-20 18:20:35 -0400
commitf654a03f1f23bea8fe5bf7194614ce6e947d0c5c (patch)
treed3d5d4a629c8cf55c5cfd17fda72d4339f064e16 /src/core/hle/kernel/thread.cpp
parent- created a Kernel namespace (diff)
downloadyuzu-f654a03f1f23bea8fe5bf7194614ce6e947d0c5c.tar.gz
yuzu-f654a03f1f23bea8fe5bf7194614ce6e947d0c5c.tar.xz
yuzu-f654a03f1f23bea8fe5bf7194614ce6e947d0c5c.zip
thread: whitespace change - fixed * and & placement
Diffstat (limited to 'src/core/hle/kernel/thread.cpp')
-rw-r--r--src/core/hle/kernel/thread.cpp50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index 2955d6f5b..cfc5327a3 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -45,8 +45,8 @@ enum WaitType {
45class Thread : public Kernel::Object { 45class Thread : public Kernel::Object {
46public: 46public:
47 47
48 const char *GetName() { return name; } 48 const char* GetName() { return name; }
49 const char *GetTypeName() { return "Thread"; } 49 const char* GetTypeName() { return "Thread"; }
50 50
51 static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Thread; } 51 static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Thread; }
52 Kernel::HandleType GetHandleType() const { return Kernel::HandleType::Thread; } 52 Kernel::HandleType GetHandleType() const { return Kernel::HandleType::Thread; }
@@ -85,11 +85,11 @@ Handle g_current_thread_handle;
85Thread* g_current_thread; 85Thread* g_current_thread;
86 86
87 87
88inline Thread *__GetCurrentThread() { 88inline Thread* __GetCurrentThread() {
89 return g_current_thread; 89 return g_current_thread;
90} 90}
91 91
92inline void __SetCurrentThread(Thread *t) { 92inline void __SetCurrentThread(Thread* t) {
93 g_current_thread = t; 93 g_current_thread = t;
94 g_current_thread_handle = t->GetHandle(); 94 g_current_thread_handle = t->GetHandle();
95} 95}
@@ -97,7 +97,7 @@ inline void __SetCurrentThread(Thread *t) {
97//////////////////////////////////////////////////////////////////////////////////////////////////// 97////////////////////////////////////////////////////////////////////////////////////////////////////
98 98
99/// Saves the current CPU context 99/// Saves the current CPU context
100void __KernelSaveContext(ThreadContext &ctx) { 100void __KernelSaveContext(ThreadContext& ctx) {
101 ctx.cpu_registers[0] = Core::g_app_core->GetReg(0); 101 ctx.cpu_registers[0] = Core::g_app_core->GetReg(0);
102 ctx.cpu_registers[1] = Core::g_app_core->GetReg(1); 102 ctx.cpu_registers[1] = Core::g_app_core->GetReg(1);
103 ctx.cpu_registers[2] = Core::g_app_core->GetReg(2); 103 ctx.cpu_registers[2] = Core::g_app_core->GetReg(2);
@@ -118,7 +118,7 @@ void __KernelSaveContext(ThreadContext &ctx) {
118} 118}
119 119
120/// Loads a CPU context 120/// Loads a CPU context
121void __KernelLoadContext(const ThreadContext &ctx) { 121void __KernelLoadContext(const ThreadContext& ctx) {
122 Core::g_app_core->SetReg(0, ctx.cpu_registers[0]); 122 Core::g_app_core->SetReg(0, ctx.cpu_registers[0]);
123 Core::g_app_core->SetReg(1, ctx.cpu_registers[1]); 123 Core::g_app_core->SetReg(1, ctx.cpu_registers[1]);
124 Core::g_app_core->SetReg(2, ctx.cpu_registers[2]); 124 Core::g_app_core->SetReg(2, ctx.cpu_registers[2]);
@@ -141,7 +141,7 @@ void __KernelLoadContext(const ThreadContext &ctx) {
141} 141}
142 142
143/// Resets a thread 143/// Resets a thread
144void __KernelResetThread(Thread *t, s32 lowest_priority) { 144void __KernelResetThread(Thread* t, s32 lowest_priority) {
145 memset(&t->context, 0, sizeof(ThreadContext)); 145 memset(&t->context, 0, sizeof(ThreadContext));
146 146
147 t->context.pc = t->entry_point; 147 t->context.pc = t->entry_point;
@@ -155,7 +155,7 @@ void __KernelResetThread(Thread *t, s32 lowest_priority) {
155} 155}
156 156
157/// Change a thread to "ready" state 157/// Change a thread to "ready" state
158void __KernelChangeReadyState(Thread *t, bool ready) { 158void __KernelChangeReadyState(Thread* t, bool ready) {
159 Handle handle = t->GetHandle(); 159 Handle handle = t->GetHandle();
160 if (t->IsReady()) { 160 if (t->IsReady()) {
161 if (!ready) { 161 if (!ready) {
@@ -172,7 +172,7 @@ void __KernelChangeReadyState(Thread *t, bool ready) {
172} 172}
173 173
174/// Changes a threads state 174/// Changes a threads state
175void __KernelChangeThreadState(Thread *t, ThreadStatus new_status) { 175void __KernelChangeThreadState(Thread* t, ThreadStatus new_status) {
176 if (!t || t->status == new_status) { 176 if (!t || t->status == new_status) {
177 return; 177 return;
178 } 178 }
@@ -187,7 +187,7 @@ void __KernelChangeThreadState(Thread *t, ThreadStatus new_status) {
187} 187}
188 188
189/// Calls a thread by marking it as "ready" (note: will not actually execute until current thread yields) 189/// Calls a thread by marking it as "ready" (note: will not actually execute until current thread yields)
190void __KernelCallThread(Thread *t) { 190void __KernelCallThread(Thread* t) {
191 // Stop waiting 191 // Stop waiting
192 if (t->wait_type != WAITTYPE_NONE) { 192 if (t->wait_type != WAITTYPE_NONE) {
193 t->wait_type = WAITTYPE_NONE; 193 t->wait_type = WAITTYPE_NONE;
@@ -196,10 +196,10 @@ void __KernelCallThread(Thread *t) {
196} 196}
197 197
198/// Creates a new thread 198/// Creates a new thread
199Thread *__KernelCreateThread(Handle &handle, const char *name, u32 entry_point, s32 priority, 199Thread* __KernelCreateThread(Handle& handle, const char* name, u32 entry_point, s32 priority,
200 s32 processor_id, u32 stack_top, int stack_size) { 200 s32 processor_id, u32 stack_top, int stack_size) {
201 201
202 Thread *t = new Thread; 202 Thread* t = new Thread;
203 203
204 handle = Kernel::g_object_pool.Create(t); 204 handle = Kernel::g_object_pool.Create(t);
205 205
@@ -221,7 +221,7 @@ Thread *__KernelCreateThread(Handle &handle, const char *name, u32 entry_point,
221} 221}
222 222
223/// Creates a new thread - wrapper for external user 223/// Creates a new thread - wrapper for external user
224Handle __KernelCreateThread(const char *name, u32 entry_point, s32 priority, s32 processor_id, 224Handle __KernelCreateThread(const char* name, u32 entry_point, s32 priority, s32 processor_id,
225 u32 stack_top, int stack_size) { 225 u32 stack_top, int stack_size) {
226 if (name == NULL) { 226 if (name == NULL) {
227 ERROR_LOG(KERNEL, "__KernelCreateThread(): NULL name"); 227 ERROR_LOG(KERNEL, "__KernelCreateThread(): NULL name");
@@ -245,7 +245,7 @@ Handle __KernelCreateThread(const char *name, u32 entry_point, s32 priority, s32
245 return -1; 245 return -1;
246 } 246 }
247 Handle handle; 247 Handle handle;
248 Thread *t = __KernelCreateThread(handle, name, entry_point, priority, processor_id, stack_top, 248 Thread* t = __KernelCreateThread(handle, name, entry_point, priority, processor_id, stack_top,
249 stack_size); 249 stack_size);
250 250
251 HLE::EatCycles(32000); 251 HLE::EatCycles(32000);
@@ -260,8 +260,8 @@ Handle __KernelCreateThread(const char *name, u32 entry_point, s32 priority, s32
260} 260}
261 261
262/// Switches CPU context to that of the specified thread 262/// Switches CPU context to that of the specified thread
263void __KernelSwitchContext(Thread* t, const char *reason) { 263void __KernelSwitchContext(Thread* t, const char* reason) {
264 Thread *cur = __GetCurrentThread(); 264 Thread* cur = __GetCurrentThread();
265 265
266 // Save context for current thread 266 // Save context for current thread
267 if (cur) { 267 if (cur) {
@@ -284,9 +284,9 @@ void __KernelSwitchContext(Thread* t, const char *reason) {
284} 284}
285 285
286/// Gets the next thread that is ready to be run by priority 286/// Gets the next thread that is ready to be run by priority
287Thread *__KernelNextThread() { 287Thread* __KernelNextThread() {
288 Handle next; 288 Handle next;
289 Thread *cur = __GetCurrentThread(); 289 Thread* cur = __GetCurrentThread();
290 290
291 if (cur && cur->IsRunning()) { 291 if (cur && cur->IsRunning()) {
292 next = g_thread_ready_queue.pop_first_better(cur->current_priority); 292 next = g_thread_ready_queue.pop_first_better(cur->current_priority);
@@ -304,13 +304,13 @@ Handle __KernelSetupMainThread(s32 priority, int stack_size) {
304 Handle handle; 304 Handle handle;
305 305
306 // Initialize new "main" thread 306 // Initialize new "main" thread
307 Thread *t = __KernelCreateThread(handle, "main", Core::g_app_core->GetPC(), priority, 307 Thread* t = __KernelCreateThread(handle, "main", Core::g_app_core->GetPC(), priority,
308 THREADPROCESSORID_0, Memory::SCRATCHPAD_VADDR_END, stack_size); 308 THREADPROCESSORID_0, Memory::SCRATCHPAD_VADDR_END, stack_size);
309 309
310 __KernelResetThread(t, 0); 310 __KernelResetThread(t, 0);
311 311
312 // If running another thread already, set it to "ready" state 312 // If running another thread already, set it to "ready" state
313 Thread *cur = __GetCurrentThread(); 313 Thread* cur = __GetCurrentThread();
314 if (cur && cur->IsRunning()) { 314 if (cur && cur->IsRunning()) {
315 __KernelChangeReadyState(cur, true); 315 __KernelChangeReadyState(cur, true);
316 } 316 }
@@ -326,7 +326,7 @@ Handle __KernelSetupMainThread(s32 priority, int stack_size) {
326/// Resumes a thread from waiting by marking it as "ready" 326/// Resumes a thread from waiting by marking it as "ready"
327void __KernelResumeThreadFromWait(Handle handle) { 327void __KernelResumeThreadFromWait(Handle handle) {
328 u32 error; 328 u32 error;
329 Thread *t = Kernel::g_object_pool.Get<Thread>(handle, error); 329 Thread* t = Kernel::g_object_pool.Get<Thread>(handle, error);
330 if (t) { 330 if (t) {
331 t->status &= ~THREADSTATUS_WAIT; 331 t->status &= ~THREADSTATUS_WAIT;
332 if (!(t->status & (THREADSTATUS_WAITSUSPEND | THREADSTATUS_DORMANT | THREADSTATUS_DEAD))) { 332 if (!(t->status & (THREADSTATUS_WAITSUSPEND | THREADSTATUS_DORMANT | THREADSTATUS_DEAD))) {
@@ -336,15 +336,15 @@ void __KernelResumeThreadFromWait(Handle handle) {
336} 336}
337 337
338/// Puts a thread in the wait state for the given type/reason 338/// Puts a thread in the wait state for the given type/reason
339void __KernelWaitCurThread(WaitType wait_type, const char *reason) { 339void __KernelWaitCurThread(WaitType wait_type, const char* reason) {
340 Thread *t = __GetCurrentThread(); 340 Thread* t = __GetCurrentThread();
341 t->wait_type = wait_type; 341 t->wait_type = wait_type;
342 __KernelChangeThreadState(t, ThreadStatus(THREADSTATUS_WAIT | (t->status & THREADSTATUS_SUSPEND))); 342 __KernelChangeThreadState(t, ThreadStatus(THREADSTATUS_WAIT | (t->status & THREADSTATUS_SUSPEND)));
343} 343}
344 344
345/// Reschedules to the next available thread (call after current thread is suspended) 345/// Reschedules to the next available thread (call after current thread is suspended)
346void __KernelReschedule(const char *reason) { 346void __KernelReschedule(const char* reason) {
347 Thread *next = __KernelNextThread(); 347 Thread* next = __KernelNextThread();
348 if (next > 0) { 348 if (next > 0) {
349 __KernelSwitchContext(next, reason); 349 __KernelSwitchContext(next, reason);
350 } 350 }