Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
PinnedObject.cs
Go to the documentation of this file.
3
5
7{
9
10 private int _isValid;
11
12 public unsafe byte* Pointer => (byte*)(void*)_handle.AddrOfPinnedObject();
13
14 public PinnedObject(object obj)
15 {
17 _isValid = 1;
18 }
19
20 protected override void Release()
21 {
22 try
23 {
24 }
25 finally
26 {
27 if (Interlocked.Exchange(ref _isValid, 0) != 0)
28 {
29 _handle.Free();
30 }
31 }
32 }
33}
static int Exchange(ref int location1, int value)
static GCHandle Alloc(object? value)
Definition GCHandle.cs:81