/***
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
There is no guarantee of any specific underlying primitive or backing by the operating system directly
*All* methods **must** be supported on all platforms. If they don't, think harder!
Implementable on: NX, Win32 via CVs, and others via pthreads
Zero timeout = infinity
*/
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;
};
}