* Process everything on the queue. * * Should be called from the Game Thread. */
| 57 | * Should be called from the Game Thread. |
| 58 | */ |
| 59 | void HandleQueue() |
| 60 | { |
| 61 | this->cancelled = callback->IsCancelled(); |
| 62 | |
| 63 | std::lock_guard<std::mutex> lock(this->mutex); |
| 64 | |
| 65 | for (auto &item : this->queue) { |
| 66 | if (item.failure) { |
| 67 | this->callback->OnFailure(); |
| 68 | } else { |
| 69 | this->callback->OnReceiveData(std::move(item.data), item.length); |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | this->queue.clear(); |
| 74 | this->queue_cv.notify_all(); |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Wait till the queue is dequeued, or a condition is met. |
no test coverage detected