2000-11-23 13:15 UTC+0800 Ron Pinkas <ron@profit-master.com>
* source/rtl/idle.c
+ Added HB_IDLE_RESET() and logic to reset Idle Processing upon such explicit request.
! If reoccuring processing of Idle Blocks is requested, hb_releaseCPU() is execusted upon completion of each cycle.
* tests/onidle.prg
+ Added HB_IDLE_RESET() to demonstrate explicit request for reoccuring processing of Idle Blocks.
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
2000-11-23 13:15 UTC+0800 Ron Pinkas <ron@profit-master.com>
|
||||
* source/rtl/idle.c
|
||||
+ Added HB_IDLE_RESET() and logic to reset Idle Processing upon such explicit request.
|
||||
! If reoccuring processing of Idle Blocks is requested, hb_releaseCPU() is execusted upon completion of each cycle.
|
||||
|
||||
* tests/onidle.prg
|
||||
+ Added HB_IDLE_RESET() to demonstrate explicit request for reoccuring processing of Idle Blocks.
|
||||
|
||||
2000-11-23 23:11 UTC+0100 jfl (mafact) <jfl@mafact.com>
|
||||
* source/vm/classes.c
|
||||
* corrected hb___msgClsParent( void )
|
||||
|
||||
@@ -69,6 +69,9 @@ USHORT hb_vm_uiIdleMaxTask = 0;
|
||||
/* flag to indicate GarbageCollection should be done in idle state. */
|
||||
BOOL hb_vm_bCollectGarbage = TRUE;
|
||||
|
||||
/* Dont allow repeated processing of Idle Tasks by default */
|
||||
BOOL hb_vm_bResetIdle = FALSE;
|
||||
|
||||
int hb_inkeyNext( void ); /* Return the next key without extracting it */
|
||||
|
||||
static void hb_releaseCPU( void )
|
||||
@@ -141,6 +144,16 @@ void hb_idleState( void )
|
||||
return;
|
||||
}
|
||||
|
||||
if( hb_vm_bResetIdle && hb_vm_uiIdleTask == hb_vm_uiIdleMaxTask )
|
||||
{
|
||||
hb_vm_bResetIdle = FALSE;
|
||||
hb_vm_uiIdleTask = 0;
|
||||
hb_vm_bCollectGarbage = TRUE;
|
||||
|
||||
hb_releaseCPU();
|
||||
return;
|
||||
}
|
||||
|
||||
hb_releaseCPU();
|
||||
|
||||
s_bIamIdle = FALSE;
|
||||
@@ -171,11 +184,17 @@ HB_FUNC( HB_IDLESTATE )
|
||||
|
||||
if( hb_vm_uiIdleTask == hb_vm_uiIdleMaxTask )
|
||||
{
|
||||
hb_vm_bResetIdle = FALSE;
|
||||
hb_vm_uiIdleTask = 0;
|
||||
hb_vm_bCollectGarbage = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
HB_FUNC( HB_IDLE_RESET )
|
||||
{
|
||||
hb_vm_bResetIdle = TRUE;
|
||||
}
|
||||
|
||||
/* add a new background task and return its handle */
|
||||
HB_FUNC( HB_IDLEADD )
|
||||
{
|
||||
|
||||
@@ -21,11 +21,11 @@ LOCAL nPrev:=SECONDS()
|
||||
@ 11,2 SAY "Memory after TEST() and before collecting" + STR( MEMORY(HB_MEM_USED) )
|
||||
HB_GCALL()
|
||||
@ 12,2 SAY "Memory after collecting" + STR( MEMORY(HB_MEM_USED) )
|
||||
nH1 = HB_IDLEADD( {|| DEVPOS(0,01), DEVOUT( TIME() )} )
|
||||
nH2 = HB_IDLEADD( {|| DEVPOS(0,21), TEST(), DEVOUT( MEMORY(HB_MEM_USED) )} )
|
||||
nH1 = HB_IDLEADD( {|| DEVPOS(0,01), DEVOUT( TIME() ), HB_IDLE_RESET() } )
|
||||
nH2 = HB_IDLEADD( {|| DEVPOS(0,21), TEST(), DEVOUT( MEMORY(HB_MEM_USED) ) } )
|
||||
nH3 = HB_IDLEADD( {|| DEVPOS(0,41), IIF(n=4,n:=1,n++),DEVOUT(aSign[n]) } )
|
||||
nH4 = HB_IDLEADD( {|| DEVPOS(0,61), DEVOUT( 1000*(SECONDS()-nPrev) ), nPrev:=SECONDS()} )
|
||||
|
||||
nH4 = HB_IDLEADD( {|| DEVPOS(0,61), DEVOUT( 1000*(SECONDS()-nPrev) ), nPrev:=SECONDS() } )
|
||||
|
||||
INKEY( 30 )
|
||||
HB_IDLEDEL( nH3 )
|
||||
HB_IDLEDEL( nH2 )
|
||||
@@ -35,7 +35,7 @@ LOCAL nPrev:=SECONDS()
|
||||
@ 13,2 SAY "Memory after idle states" + STR( MEMORY(HB_MEM_USED) )
|
||||
HB_GCALL()
|
||||
@ 14,2 SAY "Memory after collecting" + STR( MEMORY(HB_MEM_USED) )
|
||||
|
||||
|
||||
RETURN 1
|
||||
|
||||
PROC TEST()
|
||||
@@ -54,9 +54,9 @@ LOCAL cb
|
||||
c[1] :=a
|
||||
c[2] :=b
|
||||
c[3] :=c
|
||||
|
||||
|
||||
cb := {|x| x:=cb}
|
||||
EVAL( cb )
|
||||
|
||||
|
||||
RETURN
|
||||
|
||||
|
||||
Reference in New Issue
Block a user