mirror of
https://github.com/clangen/musikcube.git
synced 2024-11-19 11:10:52 +00:00
Revert some unnecessary and buggy restructuring of
RemoteLibrary::EnqueueAndWait(). While required for LocalLibrary, this causes issues with RemoteLibrary.
This commit is contained in:
parent
bd7c60fd57
commit
d612a59999
@ -199,29 +199,24 @@ int RemoteLibrary::EnqueueAndWait(QueryPtr query, size_t timeoutMs, Callback cal
|
||||
context->query = serializableQuery;
|
||||
context->callback = callback;
|
||||
|
||||
if (timeoutMs == kWaitIndefinite) {
|
||||
this->RunQuery(context);
|
||||
}
|
||||
else {
|
||||
queryQueue.push_back(context);
|
||||
queueCondition.notify_all();
|
||||
queryQueue.push_back(context);
|
||||
queueCondition.notify_all();
|
||||
|
||||
if (timeoutMs > 0) {
|
||||
while (
|
||||
!this->exit &&
|
||||
this->IsQueryInFlight(context->query) &&
|
||||
!isQueryDone(context->query))
|
||||
{
|
||||
if (timeoutMs == kWaitIndefinite) {
|
||||
this->syncQueryCondition.wait(lock);
|
||||
if (timeoutMs > 0) {
|
||||
while (
|
||||
!this->exit &&
|
||||
this->IsQueryInFlight(context->query) &&
|
||||
!isQueryDone(context->query))
|
||||
{
|
||||
if (timeoutMs == kWaitIndefinite) {
|
||||
this->syncQueryCondition.wait(lock);
|
||||
break;
|
||||
}
|
||||
else {
|
||||
auto result = this->syncQueryCondition.wait_for(lock, timeoutMs * milliseconds(1));
|
||||
if (result == std::cv_status::timeout) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
auto result = this->syncQueryCondition.wait_for(lock, timeoutMs * milliseconds(1));
|
||||
if (result == std::cv_status::timeout) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user