mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-11-10 07:06:34 +00:00
htc: fix event wait loops for rpc clients
This commit is contained in:
parent
f28a410ba0
commit
99a38dce32
4 changed files with 19 additions and 20 deletions
|
@ -84,21 +84,19 @@ namespace ams::htc::server::rpc {
|
||||||
if (os::TryWaitEvent(event)) {
|
if (os::TryWaitEvent(event)) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (m_driver->GetChannelState(m_channel_id) == state) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Wait. */
|
/* Wait. */
|
||||||
while (true) {
|
while (m_driver->GetChannelState(m_channel_id) != state) {
|
||||||
const auto idx = os::WaitAny(m_driver->GetChannelStateEvent(m_channel_id), event);
|
const auto idx = os::WaitAny(m_driver->GetChannelStateEvent(m_channel_id), event);
|
||||||
if (idx == 0) {
|
if (idx != 0) {
|
||||||
if (m_driver->GetChannelState(m_channel_id) == state) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Clear the channel state event. */
|
||||||
|
os::ClearEvent(m_driver->GetChannelStateEvent(m_channel_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result HtcmiscRpcServer::ReceiveThread() {
|
Result HtcmiscRpcServer::ReceiveThread() {
|
||||||
|
|
|
@ -184,21 +184,19 @@ namespace ams::htc::server::rpc {
|
||||||
if (os::TryWaitEvent(event)) {
|
if (os::TryWaitEvent(event)) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (m_driver->GetChannelState(m_channel_id) == state) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Wait. */
|
/* Wait. */
|
||||||
while (true) {
|
while (m_driver->GetChannelState(m_channel_id) != state) {
|
||||||
const auto idx = os::WaitAny(m_driver->GetChannelStateEvent(m_channel_id), event);
|
const auto idx = os::WaitAny(m_driver->GetChannelStateEvent(m_channel_id), event);
|
||||||
if (idx == 0) {
|
if (idx != 0) {
|
||||||
if (m_driver->GetChannelState(m_channel_id) == state) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Clear the channel state event. */
|
||||||
|
os::ClearEvent(m_driver->GetChannelStateEvent(m_channel_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RpcClient::ReceiveThread() {
|
Result RpcClient::ReceiveThread() {
|
||||||
|
|
|
@ -147,7 +147,7 @@ namespace ams::htcfs {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clear the channel state event. */
|
/* Clear the channel state event. */
|
||||||
os::ClearEvent(channel_state_event);;
|
os::ClearEvent(channel_state_event);
|
||||||
}
|
}
|
||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,10 @@ namespace ams::htcs::impl {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Start the rpc client. */
|
/* Start the rpc client. */
|
||||||
if (R_FAILED(m_rpc_client->Start())) {
|
const Result start_result = m_rpc_client->Start();
|
||||||
|
if (R_FAILED(start_result)) {
|
||||||
|
/* DEBUG */
|
||||||
|
R_ABORT_UNLESS(start_result);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue