Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetInvalidHandle() [2/2]

static T Microsoft.Win32.SafeHandles.SafeHandleCache< T >.GetInvalidHandle ( Func< T > invalidHandleFactory)
inlinestaticpackage

Definition at line 11 of file SafeHandleCache.cs.

12 {
13 T val = Volatile.Read(ref s_invalidHandle);
14 if (val == null)
15 {
16 T val2 = invalidHandleFactory();
17 val = Interlocked.CompareExchange(ref s_invalidHandle, val2, null);
18 if (val == null)
19 {
20 GC.SuppressFinalize(val2);
21 val = val2;
22 }
23 else
24 {
25 val2.Dispose();
26 }
27 }
28 return val;
29 }
static void SuppressFinalize(object obj)
Definition GC.cs:202
Definition GC.cs:8
static int CompareExchange(ref int location1, int value, int comparand)
static bool Read(ref bool location)
Definition Volatile.cs:67

References System.Threading.Interlocked.CompareExchange(), System.Threading.Volatile.Read(), Microsoft.Win32.SafeHandles.SafeHandleCache< T >.s_invalidHandle, and System.GC.SuppressFinalize().