Title: TRtcQuickJob Post by: dev 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. Title: Re: TRtcQuickJob Post by: D.Tkalcec (RTC) 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 Title: Re: TRtcQuickJob Post by: HelgeLange 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?
Title: Re: TRtcQuickJob Post by: D.Tkalcec (RTC) 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 |