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

◆ ProcessRemovals()

int System.Threading.PortableThreadPool.WaitThread.ProcessRemovals ( )
inlineprivate

Definition at line 873 of file PortableThreadPool.cs.

874 {
875 PortableThreadPool threadPoolInstance = ThreadPoolInstance;
876 threadPoolInstance._waitThreadLock.Acquire();
877 try
878 {
879 if (_numPendingRemoves == 0 || _numUserWaits == 0)
880 {
881 return _numUserWaits;
882 }
883 int numUserWaits = _numUserWaits;
884 int numPendingRemoves = _numPendingRemoves;
885 for (int i = 0; i < _numPendingRemoves; i++)
886 {
887 RegisteredWaitHandle registeredWaitHandle = _pendingRemoves[i];
888 int numUserWaits2 = _numUserWaits;
889 int j;
890 for (j = 0; j < numUserWaits2 && registeredWaitHandle != _registeredWaits[j]; j++)
891 {
892 }
893 registeredWaitHandle.OnRemoveWait();
894 if (j + 1 < numUserWaits2)
895 {
896 int num = j;
897 int num2 = numUserWaits2;
898 Array.Copy(_registeredWaits, num + 1, _registeredWaits, num, num2 - (num + 1));
899 _registeredWaits[num2 - 1] = null;
900 num++;
901 num2++;
902 Array.Copy(_waitHandles, num + 1, _waitHandles, num, num2 - (num + 1));
903 _waitHandles[num2 - 1] = null;
904 }
905 else
906 {
907 _registeredWaits[j] = null;
908 _waitHandles[j + 1] = null;
909 }
910 _numUserWaits = numUserWaits2 - 1;
911 _pendingRemoves[i] = null;
912 registeredWaitHandle.Handle.DangerousRelease();
913 }
915 return _numUserWaits;
916 }
917 finally
918 {
919 threadPoolInstance._waitThreadLock.Release();
920 }
921 }
readonly RegisteredWaitHandle[] _registeredWaits
readonly RegisteredWaitHandle[] _pendingRemoves
static readonly PortableThreadPool ThreadPoolInstance

References System.Threading.PortableThreadPool.WaitThread._numPendingRemoves, System.Threading.PortableThreadPool.WaitThread._numUserWaits, System.Threading.PortableThreadPool.WaitThread._pendingRemoves, System.Threading.PortableThreadPool.WaitThread._registeredWaits, System.Threading.PortableThreadPool.WaitThread._waitHandles, System.Threading.PortableThreadPool._waitThreadLock, System.Threading.LowLevelLock.Acquire(), System.Array.Copy(), System.Runtime.InteropServices.SafeHandle.DangerousRelease(), System.Threading.RegisteredWaitHandle.Handle, System.Threading.RegisteredWaitHandle.OnRemoveWait(), System.Threading.LowLevelLock.Release(), and System.Threading.PortableThreadPool.ThreadPoolInstance.

Referenced by System.Threading.PortableThreadPool.WaitThread.WaitThreadStart().