Browse Source

* Allocate min threads

Michaël Van Canneyt 4 years ago
parent
commit
6b36229d3c
1 changed files with 2 additions and 0 deletions
  1. 2 0
      packages/fcl-base/src/fpthreadpool.pp

+ 2 - 0
packages/fcl-base/src/fpthreadpool.pp

@@ -851,6 +851,8 @@ end;
 
 function TFPCustomSimpleThreadPool.AddTask(aTask: TThreadPoolTask): Boolean;
 begin
+  While ThreadCount<MinThreads do
+    FTaskList.AddThread;
   CheckQueuedTasks;
   Result:=DoAddTask(aTask);
   if (not Result) and QueueTasks then