Made task releasing actually work.
This commit is contained in:
@@ -263,6 +263,16 @@ public:
|
|||||||
m_taskInternal = std::move(in_otherTask.m_taskInternal);
|
m_taskInternal = std::move(in_otherTask.m_taskInternal);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
template<typename tOtherRet, eTaskRef OtherRefType, eTaskResumable OtherResumable>
|
||||||
|
bool operator ==(const Task<tOtherRet, OtherRefType, OtherResumable>& in_otherTask) noexcept
|
||||||
|
{
|
||||||
|
return m_taskInternal == in_otherTask.m_taskInternal;
|
||||||
|
}
|
||||||
|
template<typename tOtherRet, eTaskRef OtherRefType, eTaskResumable OtherResumable>
|
||||||
|
bool operator !=(const Task<tOtherRet, OtherRefType, OtherResumable>& in_otherTask) noexcept
|
||||||
|
{
|
||||||
|
return m_taskInternal != in_otherTask.m_taskInternal;
|
||||||
|
}
|
||||||
~Task() /// Destructor
|
~Task() /// Destructor
|
||||||
{
|
{
|
||||||
RemoveRef(); // Remove logical reference task
|
RemoveRef(); // Remove logical reference task
|
||||||
@@ -274,7 +284,7 @@ public:
|
|||||||
{
|
{
|
||||||
return m_taskInternal.get();
|
return m_taskInternal.get();
|
||||||
}
|
}
|
||||||
operator bool() const /// Conversion-to-bool that yields whether an underlying coroutine is set for the task
|
explicit operator bool() const /// Conversion-to-bool that yields whether an underlying coroutine is set for the task
|
||||||
{
|
{
|
||||||
return IsValid();
|
return IsValid();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,6 +140,7 @@ public:
|
|||||||
{
|
{
|
||||||
auto itWeak = std::find(m_tasks.begin(), m_tasks.end(), in_task);
|
auto itWeak = std::find(m_tasks.begin(), m_tasks.end(), in_task);
|
||||||
assert(itWeak != m_tasks.end());
|
assert(itWeak != m_tasks.end());
|
||||||
|
*itWeak = nullptr; // otherwise the next line will kill the task (in destructor)
|
||||||
m_tasks.erase(itWeak);
|
m_tasks.erase(itWeak);
|
||||||
|
|
||||||
auto itStrong = std::find(m_strongRefs.begin(), m_strongRefs.end(), in_task);
|
auto itStrong = std::find(m_strongRefs.begin(), m_strongRefs.end(), in_task);
|
||||||
|
|||||||
Reference in New Issue
Block a user