MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / HandleQueue

Method HandleQueue

src/network/core/http_shared.h:59–75  ·  view source on GitHub ↗

* Process everything on the queue. * * Should be called from the Game Thread. */

Source from the content-addressed store, hash-verified

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.

Callers 2

HTTPReceiveMethod · 0.80
HTTPReceiveMethod · 0.80

Calls 4

IsCancelledMethod · 0.45
OnFailureMethod · 0.45
OnReceiveDataMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected