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

◆ ExitSlowPath()

void System.Threading.SpinLock.ExitSlowPath ( bool useMemoryBarrier)
inlineprivate

Definition at line 271 of file SpinLock.cs.

272 {
273 bool flag = (_owner & int.MinValue) == 0;
274 if (flag && !IsHeldByCurrentThread)
275 {
276 throw new SynchronizationLockException(SR.SpinLock_Exit_SynchronizationLockException);
277 }
278 if (useMemoryBarrier)
279 {
280 if (flag)
281 {
282 Interlocked.Exchange(ref _owner, 0);
283 }
284 else
285 {
286 Interlocked.Decrement(ref _owner);
287 }
288 }
289 else if (flag)
290 {
291 _owner = 0;
292 }
293 else
294 {
295 int owner = _owner;
296 _owner = owner & -2;
297 }
298 }

References System.Threading.SpinLock._owner, System.Threading.Interlocked.Decrement(), System.Threading.Interlocked.Exchange(), System.Threading.SpinLock.IsHeldByCurrentThread, and System.SR.SpinLock_Exit_SynchronizationLockException.

Referenced by System.Threading.SpinLock.Exit(), and System.Threading.SpinLock.Exit().