Intermittent work in UI thread



Hi,

I'm trying to create a UI thread to do constant background work, but I'm having some design problems.

The thread needs to fetch records from a database. do some processing on each record and, when there are no more records, sleep for 1 minute before check the database again. The process will be controlled with thread messages (to start, pause, query...).

My problem is where should I put the processing work. I need it to be responsive between cycles, where the process waits for 1 minute, so I can stop it in that period. My only idea is using OnIdle to do the work. But then, how should I make it real idle when waiting for 1 minute?

Could anyone give some hints on what is the way to go?

Thanks

Pedro Ferreira
.



Relevant Pages

  • Re: Intermittent work in UI thread
    ... having some design problems. ... The thread needs to fetch records from a database. ... I would create a worker thread unless you need a UI thread ... thread would do it's work and then do a WaitForSingleObject() with a timeout ...
    (microsoft.public.vc.mfc)
  • Re: Access 97 to a more powerfull platform!?
    ... Moving to SQL Server is common when a database "outgrows" ... Design problems are far and away the usual reason why a database ...
    (microsoft.public.access.gettingstarted)
  • Re: Intermittent work in UI thread
    ... having some design problems. ... The thread needs to fetch records from a database. ... thread would do it's work and then do a WaitForSingleObject() with a timeout ... either the main thread sets an event for starting, pausing, querying, etc. ...
    (microsoft.public.vc.mfc)
  • Re: NULL value question
    ... I can fetch records from the database ... bar FROM baz WHERE foo IS NOT NULL ... Web Hosting by West Virginians, ...
    (comp.lang.perl.misc)
  • Question on TDataset best practices
    ... I am working on a program that needs to fetch records from a database, ... - Call a function that fetches records and returns a dataset. ... passing the dataset as a const parameter each time. ...
    (comp.lang.pascal.delphi.databases)