Background Processor

Background Processor

Postby TimStone » Tue Nov 24, 2015 11:37 pm

My update system runs every 3 hours. In Windows, I use this to control the intervals without a lot of CPU demand:

DEFINE TIMER oTmr INTERVAL 900000 OF oWnd ;
ACTION IF( ElapTime( cStart, Time()) >= "03:00:00", RunUpdater(), )
ACTIVATE TIMER oTmr

Defining a timer requires a Window, so I simply replace it with a DO WHILE .t. loop. However, I only want it to process ElapTime( ) after the interval has passed.
I was looking for the equivalent of the INTERVAL 900000 used in defining the timer, but don't exactly see one.

The routine is built in xHarbour ( commercial ) and I am doing it as a non-GUI app.

Any suggestions for a timer that won't constantly eat away at the CPU ? I thought about Seconds( ) but that is a pretty constant call. Trying to remember back to the old DOS days ...

Thanks for your input.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2909
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Background Processor

Postby Gale FORd » Wed Nov 25, 2015 12:00 am

how about HB_idleSleep( <nTime> )
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: Background Processor

Postby TimStone » Wed Nov 25, 2015 4:02 am

Is it specific to the application or generic to the os ?
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2909
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Background Processor

Postby Antonio Linares » Wed Nov 25, 2015 8:25 am

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41404
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Background Processor

Postby nageswaragunupudi » Wed Nov 25, 2015 10:13 am

You are satisfied with the functionality of Timer but the only objection to use is that it requires a Window to be activated. Probably because you want this in a program which does not do any screen i/o, eg: Service or a Scheduled Task.

You can still use a window but activate it hidden,
DEFINE WINDOW oWnd
<other code>
ACTIVATE WINDOW oWnd HIDDEN
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10308
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Background Processor

Postby TimStone » Wed Nov 25, 2015 7:15 pm

OK ... so I built the .exe and it will execute.

However, when I try to activate it as a service I get the error:

Error 1053 Service did not respond in a timely fashion

So ... this brings us back to the request for a sample of code on how to build a program that acts as a service. What do I need to add to get past the error above ?

Thanks.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2909
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 16 guests