AuroraRuntime/Source/Threading/Primitives/Event.hpp

38 lines
944 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: Event.hpp
Date: 2021-6-12
Author: Reece
***/
#pragma once
namespace Aurora::Threading::Primitives
{
class EventImpl : public IEvent
{
public:
EventImpl(bool trigged, bool atomicRelease, bool permitMultipleTriggers);
~EventImpl();
bool Init();
bool Lock(AuUInt64 timeout /*=0*/) override;
bool TryLock() override;
void Reset() override;
void Set() override;
bool HasOSHandle(AuMach &mach) override;
bool HasLockImplementation() override;
void Lock() override;
void Unlock() override;
private:
bool AtomicIsEventSet();
const bool atomicRelease_{};
const bool permitMultipleTriggers_{};
ConditionMutexUnique_t mutex_;
ConditionVariableUnique_t condition_;
2022-02-19 13:20:22 +00:00
bool triggered_;
2021-06-27 21:25:29 +00:00
};
}