/*** Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved. File: Event.hpp Date: 2021-6-9 Author: Reece ***/ #pragma once namespace Aurora::Threading::Primitives { /** Event synchronization primitive */ struct IEvent : IWaitable { // Unlike the other types, unlock is always a nop. It makes sense the caller to not automatically reset an event, contrary to `::Lock(); work; ::Unlock();` // Ordinarily, we would expect the thread responsible for work processing to ::Lock/::Unlock (maybe ::Reset()), and the dispatching thread to ::Reset and ::Set. inline void Wait() { Lock(); } inline void Wait(AuUInt32 ms) { Lock(ms); } virtual void Reset() = 0; virtual void Set() = 0; }; AUKN_SHARED_SOO2(Event, IEvent, kPrimitiveSizeEvent, ((bool, bTriggered), (bool, bAtomicRelease), (bool, bPermitMultipleTriggers)), bool bInitiallyTriggerd = false, bool bAtomicRelease = true, bool bPermitMultipleTriggers = false); }