SyncCanceler: Fix visibility; reuse helper method

This commit is contained in:
2026-05-29 12:05:36 -04:00
parent 4dbc066aac
commit 0afa3e16b8
+10 -7
View File
@@ -35,6 +35,11 @@ namespace sscl {
class SyncCancelerForAsyncWork
{
public:
struct Resources
{
bool shouldContinue = false;
};
SyncCancelerForAsyncWork() = default;
void startAcceptingWork()
@@ -56,9 +61,12 @@ public:
bool isCancellationRequested()
{
sscl::SpinLock::Guard guard(s.lock);
return !s.rsrc.shouldContinue;
return isCancellationRequestedUnlocked();
}
bool isCancellationRequestedUnlocked() const
{ return !s.rsrc.shouldContinue; }
template<typename Body>
requires std::invocable<Body>
bool execUncancelableSegmentOrAbort(Body&& body)
@@ -71,12 +79,7 @@ public:
return true;
}
private:
struct Resources
{
bool shouldContinue = false;
};
public:
sscl::SharedResourceGroup<sscl::SpinLock, Resources> s;
};