kern: unify all waiting semantics to use single api

This commit is contained in:
Michael Scire
2021-09-19 10:11:56 -07:00
parent 29940e1a82
commit df4ebae93a
22 changed files with 904 additions and 683 deletions

View File

@@ -229,11 +229,14 @@ namespace ams::kern::svc {
/* Send the request. */
MESOSPHERE_ASSERT(message != 0);
R_TRY(SendAsyncRequestWithUserBufferImpl(out_event_handle, message, buffer_size, session_handle));
const Result result = SendAsyncRequestWithUserBufferImpl(out_event_handle, message, buffer_size, session_handle);
/* We sent the request successfully. */
unlock_guard.Cancel();
return ResultSuccess();
/* If the request succeeds (or the thread is terminating), don't unlock the user buffer. */
if (R_SUCCEEDED(result) || svc::ResultTerminationRequested::Includes(result)) {
unlock_guard.Cancel();
}
return result;
}
ALWAYS_INLINE Result ReplyAndReceive(int32_t *out_index, KUserPointer<const ams::svc::Handle *> handles, int32_t num_handles, ams::svc::Handle reply_target, int64_t timeout_ns) {