Qutex: currOwner should use registered sh_ptr to Lockvoker
This ensures that the Lockvoker object we access from currOwner remains valid past the lifetime of the Lockvoker object that gets copied and invoked by boost::asio
This commit is contained in:
@@ -68,7 +68,7 @@ public:
|
||||
|
||||
// Implement the virtual method from AsynchronousContinuationChainLink
|
||||
virtual std::shared_ptr<AsynchronousContinuationChainLink>
|
||||
getCallersContinuation() override
|
||||
getCallersContinuationShPtr() override
|
||||
{ return originalCallback.callerContinuation; }
|
||||
|
||||
public:
|
||||
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
virtual ~AsynchronousContinuationChainLink() = default;
|
||||
|
||||
virtual std::shared_ptr<AsynchronousContinuationChainLink>
|
||||
getCallersContinuation() = 0;
|
||||
getCallersContinuationShPtr() = 0;
|
||||
};
|
||||
|
||||
} // namespace smo
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
* @param qutex The Qutex to get the iterator for
|
||||
* @return Iterator pointing to this lockvoker in the Qutex's queue
|
||||
*/
|
||||
virtual List::iterator getLockvokerIteratorForQutex(Qutex& qutex) = 0;
|
||||
virtual List::iterator getLockvokerIteratorForQutex(Qutex& qutex) const = 0;
|
||||
|
||||
/**
|
||||
* @brief Awaken this lockvoker by posting it to its io_service
|
||||
|
||||
+3
-2
@@ -90,13 +90,14 @@ public:
|
||||
void release();
|
||||
|
||||
#ifdef CONFIG_ENABLE_DEBUG_LOCKS
|
||||
LockerAndInvokerBase* getCurrOwner() const { return currOwner; }
|
||||
std::shared_ptr<LockerAndInvokerBase> getCurrOwner() const
|
||||
{ return currOwner; }
|
||||
#endif
|
||||
|
||||
public:
|
||||
#ifdef CONFIG_ENABLE_DEBUG_LOCKS
|
||||
std::string name;
|
||||
LockerAndInvokerBase* currOwner;
|
||||
std::shared_ptr<LockerAndInvokerBase> currOwner;
|
||||
#endif
|
||||
SpinLock lock;
|
||||
LockerAndInvokerBase::List queue;
|
||||
|
||||
@@ -154,7 +154,7 @@ public:
|
||||
* @return Iterator pointing to this lockvoker in the Qutex's queue
|
||||
*/
|
||||
LockerAndInvokerBase::List::iterator
|
||||
getLockvokerIteratorForQutex(Qutex& qutex) override
|
||||
getLockvokerIteratorForQutex(Qutex& qutex) const override
|
||||
{
|
||||
return serializedContinuation.requiredLocks.getLockUsageDesc(
|
||||
qutex).second;
|
||||
|
||||
Reference in New Issue
Block a user