ChangeLog 2000-11-27 19:55 UTC+0100

This commit is contained in:
Ryszard Glab
2000-11-27 17:49:39 +00:00
parent ad3c37cc77
commit c963ded268
3 changed files with 29 additions and 1 deletions

View File

@@ -1,3 +1,9 @@
2000-11-27 18:55 UTC+0100 Ryszard Glab <rglab@imid.med.pl>
*source/rtl/idle.c
*source/rtl/inkey.c
* Added support for CPU releasing in U*ix
2000-11-27 17:14 GMT+1 Maurilio Longo <maurilio.longo@libero.it>
* source/rtl/tbrowse.prg
* changed ::RelativePos into ::LastRetrieved (seems more descriptive to me)

View File

@@ -53,6 +53,9 @@
#include "hbapiitm.h"
#include "hbvm.h"
#include "error.ch"
#if defined(HB_OS_UNIX)
#include <time.h>
#endif
/* list of background tasks */
static HB_ITEM_PTR s_pIdleTasks = NULL;
@@ -116,6 +119,11 @@ static void hb_releaseCPU( void )
}
#elif defined(HB_OS_UNIX)
{
static struct timespec nanosecs = { 0, 1000 };
/* NOTE: it will sleep at least 10 miliseconds (forced by kernel) */
nanosleep( &nanosecs, NULL );
}
#else
#endif
}

View File

@@ -57,6 +57,9 @@
#include "inkey.ch"
#include <time.h>
#if defined( HB_OS_UNIX )
#include <sys/times.h>
#endif
static int * s_inkeyBuffer = 0; /* Harbour keyboard buffer (empty if head == tail) */
static int s_inkeyHead; /* Harbour keyboard buffer head pointer (next insert) */
@@ -104,9 +107,20 @@ int hb_inkey( BOOL bWait, double dSeconds, HB_inkey_enum event_mask )
}
else
{
#if defined( HB_OS_UNIX )
/* NOTE: clock() returns a time used by a program - if it is suspended
* then this time will be zero
*/
clock_t end_clock;
struct tms tm;
end_clock = times( &tm ) + ( clock_t ) ( dSeconds * 100 );
while( hb_inkeyNext() == 0 && (times( &tm ) < end_clock) )
#else
clock_t end_clock = clock() + ( clock_t ) ( dSeconds * CLOCKS_PER_SEC );
while( hb_inkeyNext() == 0 && clock() < end_clock )
#endif
{
hb_idleState();
}