Not sure how to implement it, but I'm trying to implement a quickjob list, where every quickjob is managing exactly 1 database as serialized job. I can't use your thread pool (although would love to), because I need several thread running but it has to be serialized for every unique database.
So far so good, I don't thinks that's problematic at all.
But when I have to shut down the service and some jobs are running, I might have to wait until they finish what they're doing. I saw in your code, that you send a simple message to tell the thread to stop, which will be received asynchron when the current job is finished.
A construct like I'd normally do
While FpJobList.Count > 0 Do begin
TRtcQuickJob(FpJobList.Items[0]).Stop;
TRtcQuickJob(FpJobList.Items[0]).Free;
FpJobList.Delete(0);
end;
Is there a possibility that you insert an event when the thread is stopped and I can remove it from the list and free the object ?
It would allow to write some bigger loop where i can wait for every single job to stop.
Thanks in advance,
Helge