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

◆ InternalRelease()

void System.Runtime.InteropServices.SafeHandle.InternalRelease ( bool disposeOrFinalizeOperation)
inlineprivateinherited

Definition at line 98 of file SafeHandle.cs.

99 {
100 bool flag = false;
101 int state;
102 int num;
103 do
104 {
105 state = _state;
106 if (disposeOrFinalizeOperation && ((uint)state & 2u) != 0)
107 {
108 return;
109 }
110 if ((state & -4) == 0)
111 {
112 throw new ObjectDisposedException("SafeHandle", SR.ObjectDisposed_SafeHandleClosed);
113 }
114 flag = (state & -3) == 4 && _ownsHandle && !IsInvalid;
115 num = state - 4;
116 if ((state & -4) == 4)
117 {
118 num |= 1;
119 }
120 if (disposeOrFinalizeOperation)
121 {
122 num |= 2;
123 }
124 }
125 while (Interlocked.CompareExchange(ref _state, num, state) != state);
126 if (flag)
127 {
128 int lastPInvokeError = Marshal.GetLastPInvokeError();
130 Marshal.SetLastPInvokeError(lastPInvokeError);
131 }
132 }
static int CompareExchange(ref int location1, int value, int comparand)

References System.Runtime.InteropServices.SafeHandle._ownsHandle, System.Runtime.InteropServices.SafeHandle._state, System.Threading.Interlocked.CompareExchange(), System.Runtime.InteropServices.Marshal.GetLastPInvokeError(), System.Runtime.InteropServices.SafeHandle.IsInvalid, System.SR.ObjectDisposed_SafeHandleClosed, System.Runtime.InteropServices.SafeHandle.ReleaseHandle(), System.Runtime.InteropServices.Marshal.SetLastPInvokeError(), and System.state.

Referenced by System.Runtime.InteropServices.SafeHandle.DangerousRelease(), and System.Runtime.InteropServices.SafeHandle.Dispose().