summaryrefslogtreecommitdiff
path: root/src/core/hle/svc.cpp
diff options
context:
space:
mode:
authorGravatar Subv2017-01-01 16:53:22 -0500
committerGravatar Subv2017-01-04 15:58:45 -0500
commite6a7723f2f4b62279cd4f6d4b48eb02a9b60ffb6 (patch)
treeb56862bb64fcf57727149de90318671ffd8afe4d /src/core/hle/svc.cpp
parentKernel/Synch: Do not attempt a reschedule on every syscall. (diff)
downloadyuzu-e6a7723f2f4b62279cd4f6d4b48eb02a9b60ffb6.tar.gz
yuzu-e6a7723f2f4b62279cd4f6d4b48eb02a9b60ffb6.tar.xz
yuzu-e6a7723f2f4b62279cd4f6d4b48eb02a9b60ffb6.zip
Kernel: Object ShouldWait and Acquire calls now take a thread as a parameter.
This will be useful when implementing mutex priority inheritance.
Diffstat (limited to 'src/core/hle/svc.cpp')
-rw-r--r--src/core/hle/svc.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index 5b538be22..159ac0bf6 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -272,7 +272,7 @@ static ResultCode WaitSynchronization1(Kernel::Handle handle, s64 nano_seconds)
272 LOG_TRACE(Kernel_SVC, "called handle=0x%08X(%s:%s), nanoseconds=%lld", handle, 272 LOG_TRACE(Kernel_SVC, "called handle=0x%08X(%s:%s), nanoseconds=%lld", handle,
273 object->GetTypeName().c_str(), object->GetName().c_str(), nano_seconds); 273 object->GetTypeName().c_str(), object->GetName().c_str(), nano_seconds);
274 274
275 if (object->ShouldWait()) { 275 if (object->ShouldWait(thread)) {
276 276
277 if (nano_seconds == 0) 277 if (nano_seconds == 0)
278 return ERR_SYNC_TIMEOUT; 278 return ERR_SYNC_TIMEOUT;
@@ -294,7 +294,7 @@ static ResultCode WaitSynchronization1(Kernel::Handle handle, s64 nano_seconds)
294 return ERR_SYNC_TIMEOUT; 294 return ERR_SYNC_TIMEOUT;
295 } 295 }
296 296
297 object->Acquire(); 297 object->Acquire(thread);
298 298
299 return RESULT_SUCCESS; 299 return RESULT_SUCCESS;
300} 300}
@@ -336,11 +336,11 @@ static ResultCode WaitSynchronizationN(s32* out, Kernel::Handle* handles, s32 ha
336 if (wait_all) { 336 if (wait_all) {
337 bool all_available = 337 bool all_available =
338 std::all_of(objects.begin(), objects.end(), 338 std::all_of(objects.begin(), objects.end(),
339 [](const ObjectPtr& object) { return !object->ShouldWait(); }); 339 [thread](const ObjectPtr& object) { return !object->ShouldWait(thread); });
340 if (all_available) { 340 if (all_available) {
341 // We can acquire all objects right now, do so. 341 // We can acquire all objects right now, do so.
342 for (auto& object : objects) 342 for (auto& object : objects)
343 object->Acquire(); 343 object->Acquire(thread);
344 // Note: In this case, the `out` parameter is not set, 344 // Note: In this case, the `out` parameter is not set,
345 // and retains whatever value it had before. 345 // and retains whatever value it had before.
346 return RESULT_SUCCESS; 346 return RESULT_SUCCESS;
@@ -380,12 +380,12 @@ static ResultCode WaitSynchronizationN(s32* out, Kernel::Handle* handles, s32 ha
380 } else { 380 } else {
381 // Find the first object that is acquirable in the provided list of objects 381 // Find the first object that is acquirable in the provided list of objects
382 auto itr = std::find_if(objects.begin(), objects.end(), 382 auto itr = std::find_if(objects.begin(), objects.end(),
383 [](const ObjectPtr& object) { return !object->ShouldWait(); }); 383 [thread](const ObjectPtr& object) { return !object->ShouldWait(thread); });
384 384
385 if (itr != objects.end()) { 385 if (itr != objects.end()) {
386 // We found a ready object, acquire it and set the result value 386 // We found a ready object, acquire it and set the result value
387 Kernel::WaitObject* object = itr->get(); 387 Kernel::WaitObject* object = itr->get();
388 object->Acquire(); 388 object->Acquire(thread);
389 *out = std::distance(objects.begin(), itr); 389 *out = std::distance(objects.begin(), itr);
390 return RESULT_SUCCESS; 390 return RESULT_SUCCESS;
391 } 391 }