[*] Harden AuFutures against OOM

This commit is contained in:
Reece Wilson 2024-03-17 16:09:24 +00:00
parent 41a7ddf51c
commit 1e53972a2a

View File

@ -43,6 +43,7 @@ public:
void OnComplete(CompleteCallback_f callback)
{
AU_DEBUG_MEMCRUNCH;
AU_LOCK_GUARD(this->mutex);
if (this->bComplete)
@ -77,6 +78,7 @@ public:
void OnFailure(ErrorCallback_f onFailure)
{
AU_DEBUG_MEMCRUNCH;
AU_LOCK_GUARD(this->mutex);
if (this->bFailed)
@ -112,6 +114,7 @@ public:
template<typename T1 = T, AuEnableIf_t<!AuIsVoid_v<T1>> * = nullptr>
void Complete(Move_t value)
{
AU_DEBUG_MEMCRUNCH;
AU_LOCK_GUARD(this->mutex);
ExchangeDone();
@ -385,6 +388,7 @@ struct AuWaterfall : AuEnableSharedFromThis<AuWaterfall>
void OnFailure(AuVoidFunc onFailure)
{
AU_DEBUG_MEMCRUNCH;
AU_LOCK_GUARD(this->mutex);
if (this->bDone)
@ -406,6 +410,7 @@ struct AuWaterfall : AuEnableSharedFromThis<AuWaterfall>
void OnSuccess(AuVoidFunc onSuccess)
{
AU_DEBUG_MEMCRUNCH;
AU_LOCK_GUARD(this->mutex);
if (this->bDone)