AuroraRuntime/Include/Aurora/Threading/IWaitable.hpp
2021-06-27 22:25:29 +01:00

29 lines
903 B
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: IWaitable.hpp
Date: 2021-6-10
Author: Reece
***/
#pragma once
namespace Aurora::Threading
{
/**
IWaitable represents a generic waitable primitive <br>
There is no guarantee of any specific underlying primitive or backing by the operating system directly <br>
*All* methods **must** be supported on all platforms. If they don't, think harder! <br>
Implementable on: NX, Win32 via CVs, and others via pthreads <br>
Zero timeout = infinity <br>
*/
class IWaitable
{
public:
virtual bool HasOSHandle(AuMach &mach) = 0;
virtual bool HasLockImplementation() = 0;
virtual void Lock() = 0;
virtual bool Lock(AuUInt64 timeout /*=0*/) = 0;
virtual bool TryLock() = 0;
virtual void Unlock() = 0;
};
}