Reece
d755a9d651
[*] Refactor ambiguous IWaitable::Lock(timeoutMs) to LockMS to prevent final using collisions
53 lines
1.1 KiB
C++
53 lines
1.1 KiB
C++
/***
|
|
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: CBWaitable.hpp
|
|
Date: 2021-6-10
|
|
Author: Reece
|
|
***/
|
|
#pragma once
|
|
|
|
namespace Aurora::Threading::Waitables
|
|
{
|
|
class CBWaitable : public IWaitable
|
|
{
|
|
public:
|
|
CBWaitable(const AuFunction<bool()> &value) : callback_(value)
|
|
{
|
|
}
|
|
|
|
bool TryLock() override
|
|
{
|
|
return callback_();
|
|
}
|
|
|
|
bool HasOSHandle(AuMach &mach) override
|
|
{
|
|
return false;
|
|
}
|
|
|
|
bool HasLockImplementation() override
|
|
{
|
|
return false;
|
|
}
|
|
|
|
void Unlock() override
|
|
{
|
|
SysPanic("CBWaitable is incompatible with WaitFor given an array of IWaitables");
|
|
}
|
|
|
|
void Lock() override
|
|
{
|
|
SysPanic("CBWaitable is not lockable");
|
|
}
|
|
|
|
bool LockMS(AuUInt64 timeout) override
|
|
{
|
|
SysPanic("CBWaitable is not lockable");
|
|
return false;
|
|
}
|
|
|
|
private:
|
|
AuFunction<bool()> callback_;
|
|
};
|
|
} |