RTC Forums
November 24, 2024, 07:02:15 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 4787 times)
dev
Newbie
*
Posts: 10


« on: May 28, 2014, 09:45:42 PM »

Hello.

The documentation on TRtcQuickJob is a little sketchy and I do not recall it well enough.
When you have a moment, can anyone please explain what TRtcQuickJob is meant for, and how it should be used?

Thanks.
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 on: May 28, 2014, 10:07:20 PM »

1. Implement the OnExecute event on the TRtcQuickJob component to handle the "job" which you want to have executed asynchronously.

2. Set the Serialized property to TRUE if you only want one job to be executed at a time, serializing calls to make sure there will never be more than one job running on this component. If you want to allow multiple jobs to run at the same time, leave the Serialized property as FALSE (default).

3. If the job requires GUI access, set the AccessGUI property to TRUE. Doing this would also serialize jobs, since access to the GUI requires your code to be synchronized with the main thread. If your OnExecute event code can be safely executed from the background thread, leave the AccessGUI property as FALSE (default).

4. To post the next job to the job queue, use the Post method on the TRtcQuickJob component. If you need to pass custom data to the event, create an object of type TRtcValue, or any other type derived from TRtcValueObject, and use it as a parameter to the Post call. If you pass an object to the Post call, be aware that it will be destroyed automatically by the component afterwards.

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


« Reply #2 on: May 13, 2015, 12:31:11 AM »

What happens to the thread from the quickjob while there is no job posted, but I didn't stop the thread either... Suspended ? Sleeping ? Checking all the time if there is some new job to do?
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #3 on: May 13, 2015, 07:15:32 AM »

Threads keep running in idle mode, until there is a job posted into the queue that needs executing. Jobs are posted into the queue from all RTC components that use threads. For example TRtcHttpClient and TRtcHttpServer and not just the TRtcQuickJob component. For serialized jobs, RTC Thread Pool uses "virtual threads". These are simply lists of jobs which need to be executed in a specific order from a single thread.

Best Regards,
Danijel Tkalcec
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.026 seconds with 17 queries.