There is this strange error i am encountering where omnithread stops scheduling tasks and just stops working...
Here is the code to reproduce the error i am having
Procedure PerformOperations(const task: IOmniTask);
Begin
Sleep(1000);
End;
procedure TForm1.Button1Click(Sender: TObject);
Var I: Integer;
begin
for I := 0 to 200 do
CreateTask(PerformOperations).
UnObserved.Schedule(ThreadPool);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
ThreadPool := CreateThreadPool('ThreadPool');
ThreadPool.MaxExecuting := 60;
ThreadPool.MaxQueued := 0;
end;
When i click on the button it creates 200 tasks fine, but while looking at the thread count from task manager, as soon as the threads starts decreasing if i click on button1 that moment then thread count suddenly drops to 0 and after that no matter how many times i click on button1 for scheduling tasks no thread is created and no function is performed. i actually encountered this error while sending data to server which schedule the tasks, i wasnt able to separate the server code areas so i just wrote a sample for generating the issue at user end. Can anyone help me on how to fix this issue?
Thanks