AuroraRuntime/Include/Aurora/Threading/IWaitable.hpp

28 lines
892 B
C++
Raw Normal View History

2021-06-27 21:25:29 +00:00
/***
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>
*/
2022-06-01 21:49:38 +00:00
struct IWaitable
2021-06-27 21:25:29 +00:00
{
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;
};
}