MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / pollReady

Method pollReady

Libraries/HttpClient/HttpClientScheduler.cpp:109–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107}
108
109SC::Result SC::HttpClientOperationScheduler::pollReady(size_t& numPolled, uint32_t waitMilliseconds)
110{
111 SC_TRY_MSG(initialized, "HttpClientOperationScheduler: not initialized");
112
113 numPolled = 0;
114
115 readyMutex.lock();
116 if (not hasReadyOperationLocked() and waitMilliseconds > 0 and hasRequestsInFlight())
117 {
118 (void)readyCV.wait(readyMutex, waitMilliseconds);
119 }
120 readyMutex.unlock();
121
122 for (size_t idx = 0; idx < schedulerMemory.operations.sizeInElements(); ++idx)
123 {
124 bool shouldPoll = false;
125 readyMutex.lock();
126 if (schedulerMemory.readyOperations[idx] != 0)
127 {
128 schedulerMemory.readyOperations[idx] = 0;
129 shouldPoll = true;
130 }
131 readyMutex.unlock();
132
133 if (shouldPoll)
134 {
135 SC_TRY(schedulerMemory.operations[idx]->poll(0));
136 numPolled += 1;
137 }
138 }
139 return Result(true);
140}
141
142SC::Result SC::HttpClientOperationScheduler::pollAll(size_t& numPolled)
143{

Callers 2

operationSchedulerMethod · 0.80
saneMainFunction · 0.80

Calls 5

pollMethod · 0.80
ResultClass · 0.50
lockMethod · 0.45
waitMethod · 0.45
unlockMethod · 0.45

Tested by 1

operationSchedulerMethod · 0.64