Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
GenericPlatformCriticalSection.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/Timespan.h"
7
8/** Platforms that don't need a working FSystemWideCriticalSection can just typedef this one */
10{
11public:
12 /** Construct a named, system-wide critical section and attempt to get access/ownership of it */
14
15 /** Destructor releases system-wide critical section if it is currently owned */
17
18 /**
19 * Does the calling thread have ownership of the system-wide critical section?
20 *
21 * @return True if the system-wide lock is obtained.
22 */
23 bool IsValid() const { return false; }
24
25 /** Releases system-wide critical section if it is currently owned */
26 void Release() {}
27
28private:
31};
32
33/**
34 * TGenericPlatformRWLock - Read/Write Mutex
35 * - Provides non-recursive Read/Write (or shared-exclusive) access.
36 * - As a fallback default for non implemented platforms, using a single FCriticalSection to provide complete single mutual exclusion - no seperate Read/Write access.
37 */
38template<class CriticalSection>
40{
41public:
44
46 {
47 }
48
50 {
51 }
52
54 {
55 Mutex.Lock();
56 }
57
59 {
60 Mutex.Lock();
61 }
62
64 {
65 return Mutex.TryLock();
66 }
67
69 {
70 return Mutex.TryLock();
71 }
72
74 {
75 Mutex.Unlock();
76 }
77
79 {
80 Mutex.Unlock();
81 }
82
83private:
84 CriticalSection Mutex;
85};
#define FORCEINLINE
Definition Platform.h:644
FSystemWideCriticalSectionNotImplemented(const FSystemWideCriticalSectionNotImplemented &)
FSystemWideCriticalSectionNotImplemented & operator=(const FSystemWideCriticalSectionNotImplemented &)
FSystemWideCriticalSectionNotImplemented(const FString &Name, FTimespan Timeout=FTimespan::Zero())
TGenericPlatformRWLock(const TGenericPlatformRWLock &)=delete
TGenericPlatformRWLock & operator=(const TGenericPlatformRWLock &)=delete
static FTimespan Zero()
Definition Timespan.h:747