Repair Delay Bug

Miscellaneous Forums/Linux Discussion/Repair Delay Bug

The Forum Archive is locked. These are the original blitzbasic.com forums, kept so their posts can still be read and searched. No new topics, replies or edits can be made here. To join the conversation, head over to the Blitz3D+ forums.

Whom you test the following code, then the CPU is always working at full capacity 100%.

Graphics 800,600,0


While Not KeyHit(KEY_ESCAPE)

   DrawRect Rnd(0,800),Rnd(0,600),10,10

   
   Flip

   Delay 1000

Wend


Edit the following lines in: ../mod/brl.mod/system.mod/system.linux.c

1. One adds the following line:

#include <unistd.h>

2. Change the following function:

form:
void bbSystemDelay( int millis ){
   int      t;
   t=brl_system_MilliSecs();
   while (brl_system_MilliSecs()-t<millis) {}
//   usleep( millis/1000 );
}


to:

void bbSystemDelay( unsigned long millis ){
	usleep( millis * 1000 );
}


3. And Build Modules. Now works delay correctly.