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

Method reactivateRequest

Libraries/Async/Async.cpp:164–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162//-------------------------------------------------------------------------------------------------------
163
164void SC::AsyncResult::reactivateRequest(bool shouldBeReactivated)
165{
166 if (hasBeenReactivated)
167 *hasBeenReactivated = shouldBeReactivated;
168 if (shouldBeReactivated)
169 {
170 switch (async.state)
171 {
172 case AsyncRequest::State::Free: {
173 if (AsyncEventLoop::Internal::KernelEvents::needsSubmissionWhenReactivating(async))
174 {
175 async.state = AsyncRequest::State::Reactivate;
176 eventLoop.internal.submissions.queueBack(async);
177 eventLoop.internal.numberOfSubmissions += 1;
178 }
179 else
180 {
181 async.state = AsyncRequest::State::Submitting;
182 eventLoop.internal.addActiveHandle(async);
183 }
184 }
185 break;
186 case AsyncRequest::State::Reactivate: {
187 // Nothing to do
188 }
189 break;
190 case AsyncRequest::State::Cancelling:
191 case AsyncRequest::State::Active:
192 case AsyncRequest::State::Setup: {
193 // Should not happen
194 SC_ASYNC_ASSERT_RELEASE(false);
195 }
196 break;
197 case AsyncRequest::State::Submitting:
198 SC_ASYNC_ASSERT_RELEASE(AsyncEventLoop::Internal::KernelEvents::needsSubmissionWhenReactivating(async));
199 break;
200 }
201 }
202 else
203 {
204 switch (async.state)
205 {
206 case AsyncRequest::State::Free: {
207 // Nothing to do
208 }
209 break;
210 case AsyncRequest::State::Reactivate: {
211 // TODO: Is a teardown needed here?
212 async.state = AsyncRequest::State::Free;
213 eventLoop.internal.submissions.remove(async);
214 eventLoop.internal.numberOfSubmissions -= 1;
215 }
216 break;
217 case AsyncRequest::State::Cancelling:
218 case AsyncRequest::State::Active:
219 case AsyncRequest::State::Setup: {
220 // Should not happen
221 SC_ASYNC_ASSERT_RELEASE(false);

Callers 15

startMethod · 0.80
tryParseResponseMethod · 0.80
onTimeoutMethod · 0.80
snippetForTimeoutFunction · 0.80
snippetForWakeUp1Function · 0.80
snippetForWakeUp2Function · 0.80
snippetForSocketAcceptFunction · 0.80
snippetForSocketReceiveFunction · 0.80
snippetForFileReadFunction · 0.80

Calls 3

addActiveHandleMethod · 0.80
queueBackMethod · 0.45
removeMethod · 0.45

Tested by 15

startMethod · 0.64
tryParseResponseMethod · 0.64
onTimeoutMethod · 0.64
snippetForTimeoutFunction · 0.64
snippetForWakeUp1Function · 0.64
snippetForWakeUp2Function · 0.64
snippetForSocketAcceptFunction · 0.64
snippetForSocketReceiveFunction · 0.64
snippetForFileReadFunction · 0.64