RTC Forums
November 24, 2024, 06:58:47 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: TRtcQuickJob  (Read 4494 times)
HelgeLange
RTC Expired
*
Posts: 100


« on: May 12, 2015, 11:23:22 PM »

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

Code:
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
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 on: May 12, 2015, 11:29:14 PM »

TRtcQuickJob components do NOT create nor do they stop threads. They use the RTC Thread Pool. The main reason for the existence of the TRtcQuickJob component, is to allow simple execution of quick jobs in the background, without having to manually create and destroy threads.

Best Regards,
Danijel Tkalcec
Logged
HelgeLange
RTC Expired
*
Posts: 100


« Reply #2 on: May 13, 2015, 12:41:08 AM »

Ah, I understand now... I can destroy the component without problems, the job will continue running until it's done anyway and the the pool will destroy it because of the quit message...
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.024 seconds with 17 queries.