Alaska Software Inc. - :setInterval() vs. AppEvent(,,,nTimeOut)
Username: Password:
AuthorTopic: :setInterval() vs. AppEvent(,,,nTimeOut)
AUGE_OHR:setInterval() vs. AppEvent(,,,nTimeOut)
on Tue, 14 Jul 2009 04:29:58 +0200
hi,

here some Code where nTimeout is < 100/100Sec

*** Code ***
LOCAL oThread  := Thread():new()
   oThread:start({||oDlg:Checkit()})
   oThread:setInterval(nTimeout)
   DO WHILE !lExit
      nEvent := AppEvent ( @mp1, @mp2, @oXbp)
*** eof ***

will increase handle and RAM and crash after some Time

*** Code ***
METHOD HP_Anzeige:Checkit(strComputer)
DEFAULT strComputer TO "Localhost"

   IF ::objWMIService == NIL
      IF ::lVISTA
         ::objWMIService  := CreateObject(".....
      ELSE
         ::objWMIService  := GetObject("...
      ENDIF
   ENDIF
   
    here it crash with :setInterval() after a while,
    but run with AppEvent( , , , 4th Parameter)
   
   colItems := ::objWMIService:ExecQuery("select * from NumericSensor",,48)

   bCollBlock     := {|oService,n| AADD(aItem,{ n,;
                       oService:CurrentReading        ,;
                       oService:UpperThresholdCritical,;
                       oService:CurrentState          ,;
                       oService:NominalReading }      )}

   ComEvalCollection(colItems, bCollBlock )
*** eof ***

calling same Methode with this Code does run 24Std and more

*** Code ***
   DO WHILE !lExit
      nEvent := AppEvent ( @mp1, @mp2, @oXbp, nTimeout )
      DO CASE
      CASE nEvent == xbe_None
         oDlg:Checkit()
*** eof ***

so what happend when using oThread:setInterval(nTimeout) ?

greetings by OHR
Jimmy





ExecQuery.jpg
James Loughner Re: :setInterval() vs. AppEvent(,,,nTimeOut)
on Mon, 13 Jul 2009 23:23:02 -0400
I'd say it times out and thus quits before the checkit method has time
to do its thing. If you increase the interval does it work?. In fact in
context why are you setting any interval? You do want the method to run
to the end?

Jim



AUGE_OHR wrote:
> hi,
> 
> here some Code where nTimeout is < 100/100Sec
> 
> *** Code ***
> LOCAL oThread  := Thread():new()
>    oThread:start({||oDlg:Checkit()})
>    oThread:setInterval(nTimeout)
>    DO WHILE !lExit
>       nEvent := AppEvent ( @mp1, @mp2, @oXbp)
> *** eof ***
> 
> will increase handle and RAM and crash after some Time
> 
> *** Code ***
> METHOD HP_Anzeige:Checkit(strComputer)
> DEFAULT strComputer TO "Localhost"
> 
>    IF ::objWMIService == NIL
>       IF ::lVISTA
>          ::objWMIService  := CreateObject(".....
>       ELSE
>          ::objWMIService  := GetObject("...
>       ENDIF
>    ENDIF
>    
>     here it crash with :setInterval() after a while,
>     but run with AppEvent( , , , 4th Parameter)
>    
>    colItems := ::objWMIService:ExecQuery("select * from NumericSensor",,48)
> 
>    bCollBlock     := {|oService,n| AADD(aItem,{ n,;
>                        oService:CurrentReading        ,;
>                        oService:UpperThresholdCritical,;
>                        oService:CurrentState          ,;
>                        oService:NominalReading }      )}
> 
>    ComEvalCollection(colItems, bCollBlock )
> *** eof ***
> 
> calling same Methode with this Code does run 24Std and more
> 
> *** Code ***
>    DO WHILE !lExit
>       nEvent := AppEvent ( @mp1, @mp2, @oXbp, nTimeout )
>       DO CASE
>       CASE nEvent == xbe_None
>          oDlg:Checkit()
> *** eof ***
> 
> so what happend when using oThread:setInterval(nTimeout) ?
> 
> greetings by OHR
> Jimmy
> 
> 
> 
>
AUGE_OHRRe: :setInterval() vs. AppEvent(,,,nTimeOut)
on Tue, 14 Jul 2009 06:35:21 +0200
hi,

> I'd say it times out and thus quits before the checkit method
> has time to do its thing.

>>    oThread:setInterval(nTimeout)
>>    nEvent := AppEvent ( @mp1, @mp2, @oXbp, nTimeout )

while i both use same nTimeout all Code should have done
before next Call. "Data" from AppEvent() look fine (nobody
"touch" this Service .. only me) so i think "Time" 98/100 is fine

>If you increase the interval does it work?.

No, same happend if increase 10x nTimeout 998/100

>In fact in  context why are you setting any interval?
>You do want the method to run to the end?

Yes 

i does read "live" Temperatur from HP Proliant Server
using Xbase++ and WMI. i use a Array with 86400 Elements
(60*60*24) so i call WMI every Second like Sysinfo etc.
Taskmanger increase from 1% to about 4%-5% as Peak
running on CPU 2, so overall it is about 2%

using Appevent(,,,4th Parameter) does work 24Std/Day.
it does increase "handle" and RAM every Time, but also
"free" it after Code have finsh.

... is it a Thread or Thread/WMI Problem ... ?

greetings by OHR
Jimmy