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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user