Lockvoker: Add registerInLockSet

We now create the sh_ptr to the copy of a lockvoker object in its
own supplied register method. This enables us to retain type safety
when calling make_shared, by copying the most derived version of
the lockvoker object. Then we can pass in the LockerAndInvokerBase
to the rest of the call chain.
This commit is contained in:
2025-09-30 02:55:25 -04:00
parent 08122c086c
commit ca9eae197f
3 changed files with 17 additions and 9 deletions
+14 -1
View File
@@ -253,6 +253,19 @@ public:
void allowAwakening()
{ serializedContinuation.isAwakeOrBeingAwakened.store(false); }
/** EXPLANATION:
* Creates a shared_ptr copy of this lockvoker and registers it with
* the serialized continuation's LockSet.
*/
void registerInLockSet()
{
auto sharedLockvoker = std::make_shared<
LockerAndInvoker<InvocationTargetT>>(*this);
serializedContinuation.requiredLocks.registerInQutexQueues(
sharedLockvoker);
}
/**
* @brief First wake - register in queues and awaken
*
@@ -263,7 +276,7 @@ public:
void firstWake()
{
serializedContinuation.isAwakeOrBeingAwakened.store(true);
serializedContinuation.requiredLocks.registerInQutexQueues(*this);
registerInLockSet();
// Force awaken since we just set the flag above
awaken(true);
}