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

◆ SetMaxThreads()

bool System.Threading.PortableThreadPool.SetMaxThreads ( int workerThreads,
int ioCompletionThreads )
inline

Definition at line 1442 of file PortableThreadPool.cs.

1443 {
1444 if (workerThreads <= 0 || ioCompletionThreads <= 0)
1445 {
1446 return false;
1447 }
1449 try
1450 {
1451 if (workerThreads < _minThreads || !ThreadPool.CanSetMaxIOCompletionThreads(ioCompletionThreads))
1452 {
1453 return false;
1454 }
1455 ThreadPool.SetMaxIOCompletionThreads(ioCompletionThreads);
1456 if (ForcedMaxWorkerThreads != 0)
1457 {
1458 return true;
1459 }
1460 short num = (_maxThreads = (short)Math.Min(workerThreads, 32767));
1462 {
1464 }
1465 return true;
1466 }
1467 finally
1468 {
1470 }
1471 }

References System.Threading.PortableThreadPool._maxThreads, System.Threading.PortableThreadPool._minThreads, System.Threading.PortableThreadPool._separated, System.Threading.PortableThreadPool._threadAdjustmentLock, System.Threading.LowLevelLock.Acquire(), System.Threading.ThreadPool.CanSetMaxIOCompletionThreads(), System.Threading.PortableThreadPool.CacheLineSeparated.counts, System.Threading.PortableThreadPool.ForcedMaxWorkerThreads, System.Threading.PortableThreadPool.ThreadCounts.InterlockedSetNumThreadsGoal(), System.Math.Min(), System.Threading.PortableThreadPool.ThreadCounts.NumThreadsGoal, System.Threading.LowLevelLock.Release(), and System.Threading.ThreadPool.SetMaxIOCompletionThreads().