smartthreadpool: do not start a thread before register it

This commit is contained in:
UbitUmarov
2021-09-03 14:54:54 +01:00
parent 94d1cf1205
commit 1e1ec44707

View File

@@ -646,7 +646,6 @@ namespace Amib.Threading
workerThread.Priority = _stpStartInfo.ThreadPriority;
workerThread.Name = string.Format("STP:{0}:{1}", Name, _threadCounter);
workerThread.Start();
Interlocked.Exchange(ref _lastThreadCreateTS, DateTime.UtcNow.Ticks);
++_threadCounter;
@@ -655,6 +654,8 @@ namespace Amib.Threading
// Add it to the dictionary and update its creation time.
_workerThreads[workerThread.ManagedThreadId] = new ThreadEntry(this, workerThread);
workerThread.Start();
_windowsPCs.SampleThreads(_workerThreads.Count, _inUseWorkerThreads);
_localPCs.SampleThreads(_workerThreads.Count, _inUseWorkerThreads);
}