Async: Drop-in SyncCancelerForAsyncWork without execUncancelableSegment*
We're doing this to prep for the coro port
This commit is contained in:
@@ -18,8 +18,7 @@ constexpr unsigned int reattachInFlightStaleThresholdMultiplier = 4;
|
||||
|
||||
DeviceReattacher::DeviceReattacher(
|
||||
DeviceManager& parent, std::shared_ptr<sscl::ComponentThread> ioThread)
|
||||
: parent(parent), ioThread(ioThread), shouldContinue(false),
|
||||
timer(ioThread->getIoService())
|
||||
: parent(parent), ioThread(ioThread), timer(ioThread->getIoService())
|
||||
{
|
||||
}
|
||||
|
||||
@@ -41,16 +40,16 @@ mrntt::MrnttNonViralPostingInvoker DeviceReattacher::reattachKnownListCReq(
|
||||
|
||||
void DeviceReattacher::start()
|
||||
{
|
||||
shouldContinue = true;
|
||||
deviceReattacherCanceler.startAcceptingWork();
|
||||
scheduleNextTimeout();
|
||||
}
|
||||
|
||||
void DeviceReattacher::stop()
|
||||
{
|
||||
{
|
||||
sscl::SpinLock::Guard lock(shouldContinueLock);
|
||||
shouldContinue = false;
|
||||
sscl::SpinLock::Guard guard(deviceReattacherCanceler.s.lock);
|
||||
reattachOpInFlight = false;
|
||||
deviceReattacherCanceler.s.rsrc.shouldContinue = false;
|
||||
/** EXPLANATION:
|
||||
* Do not call reattachCReqInvoker.reset() here. Forcibly destroying
|
||||
* the invoker would tear down an in-flight reattach coroutine frame
|
||||
@@ -65,7 +64,7 @@ void DeviceReattacher::stop()
|
||||
|
||||
void DeviceReattacher::scheduleNextTimeout()
|
||||
{
|
||||
if (!shouldContinue) {
|
||||
if (deviceReattacherCanceler.isCancellationRequestedUnlocked()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -88,7 +87,7 @@ void DeviceReattacher::holdReattachCReq()
|
||||
reattachLifetimeExceptionPtr,
|
||||
[this]()
|
||||
{
|
||||
sscl::SpinLock::Guard lock(shouldContinueLock);
|
||||
sscl::SpinLock::Guard guard(deviceReattacherCanceler.s.lock);
|
||||
reattachOpInFlight = false;
|
||||
}));
|
||||
}
|
||||
@@ -107,8 +106,8 @@ void DeviceReattacher::onTimeout(const boost::system::error_code& error)
|
||||
return;
|
||||
}
|
||||
|
||||
sscl::SpinLock::Guard lock(shouldContinueLock);
|
||||
if (!shouldContinue) {
|
||||
sscl::SpinLock::Guard guard(deviceReattacherCanceler.s.lock);
|
||||
if (deviceReattacherCanceler.isCancellationRequestedUnlocked()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user