Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
SingleThreadEvent.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreTypes.h"
6#include "Misc/AssertionMacros.h"
7#include "HAL/Event.h"
8
9/**
10 * Fake event object used when running with only one thread.
11 */
13 : public FEvent
14{
15 /** Flag to know whether this event has been triggered. */
17
18 /** Should this event reset automatically or not. */
20
21public:
22
23 /** Default constructor. */
25 : bTriggered(false)
26 , bManualReset(false)
27 { }
28
29public:
30
31 // FEvent Interface
32
33 virtual bool Create( bool bIsManualReset = false ) override
34 {
35 bManualReset = bIsManualReset;
36 return true;
37 }
38
39 virtual bool IsManualReset() override
40 {
41 return bManualReset;
42 }
43
44 virtual void Trigger() override
45 {
46 bTriggered = true;
47 }
48
49 virtual void Reset() override
50 {
51 bTriggered = false;
52 }
53
54 virtual bool Wait( uint32 WaitTime, const bool bIgnoreThreadIdleStats = false ) override
55 {
56 // With only one thread it's assumed the event has been triggered
57 // before Wait is called, otherwise it would end up waiting forever or always fail.
58 check(bTriggered);
60 return true;
61 }
62};
#define check(expr)
Definition Event.h:21
virtual void Reset() override
virtual bool IsManualReset() override
virtual bool Wait(uint32 WaitTime, const bool bIgnoreThreadIdleStats=false) override
virtual bool Create(bool bIsManualReset=false) override
virtual void Trigger() override