Skip to content

Commit

Permalink
cyber: refactor WaitEnqueue templates
Browse files Browse the repository at this point in the history
  • Loading branch information
freeHackOfJeff authored and xiaoxq committed Apr 4, 2019
1 parent 6b63854 commit 0ec8141
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions cyber/base/bounded_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,13 @@ bool BoundedQueue<T>::WaitEnqueue(const T& element) {
while (!break_all_wait_) {
if (Enqueue(element)) {
return true;
} else {
if (wait_strategy_->EmptyWait()) {
}
if (wait_strategy_->EmptyWait()) {
continue;
}
// wait timeout
return false;
}
// wait timeout
}

return false;
}

Expand All @@ -187,14 +186,13 @@ bool BoundedQueue<T>::WaitEnqueue(T&& element) {
while (!break_all_wait_) {
if (Enqueue(element)) {
return true;
} else {
if (wait_strategy_->EmptyWait()) {
continue;
}
// wait timeout
return false;
}
if (wait_strategy_->EmptyWait()) {
continue;
}
// wait timeout
}

return false;
}

Expand All @@ -203,14 +201,13 @@ bool BoundedQueue<T>::WaitDequeue(T* element) {
while (!break_all_wait_) {
if (Dequeue(element)) {
return true;
} else {
if (wait_strategy_->EmptyWait()) {
}
if (wait_strategy_->EmptyWait()) {
continue;
}
// wait timeout
return false;
}
// wait timeout
}

return false;
}

Expand Down

0 comments on commit 0ec8141

Please sign in to comment.