efgee
01-09-2010, 02:13
Hi,
I've copied hellowin1.tbasic to hellowin1.bas and deleted all tbasic stuff in order to get a pure oxygen source file.
It compiles fine with co2 but the compiled application has a cpu load of 50% on a intel cpu with hyperthreading.
The only way I could get the program to operate normally was to change the message loop to:
;MESSAGE LOOP
;
do while GetMessage (&wm, 0, 0, 0) > 0
TranslateMessage (&wm)
DispatchMessage (&wm)
sleep(1)
wend
As it can be seen I've added a sleep command.
Sleep (Win32 API) takes int numbers as milliseconds; so putting the application to sleep for 1 millisecond did the trick.
My question though is:
I've never had to add a delay in a windows application message loop in order to bring the cpu load down. (with different compilers and languages...)
This doesn't happen if I compile hellowin1.tbasic (the thinbasic interpreter is invoked) but happens if hellowin1.bas is directly compiled as:
co2 hellowin1
Did I miss something?
Bye
efgee
I've copied hellowin1.tbasic to hellowin1.bas and deleted all tbasic stuff in order to get a pure oxygen source file.
It compiles fine with co2 but the compiled application has a cpu load of 50% on a intel cpu with hyperthreading.
The only way I could get the program to operate normally was to change the message loop to:
;MESSAGE LOOP
;
do while GetMessage (&wm, 0, 0, 0) > 0
TranslateMessage (&wm)
DispatchMessage (&wm)
sleep(1)
wend
As it can be seen I've added a sleep command.
Sleep (Win32 API) takes int numbers as milliseconds; so putting the application to sleep for 1 millisecond did the trick.
My question though is:
I've never had to add a delay in a windows application message loop in order to bring the cpu load down. (with different compilers and languages...)
This doesn't happen if I compile hellowin1.tbasic (the thinbasic interpreter is invoked) but happens if hellowin1.bas is directly compiled as:
co2 hellowin1
Did I miss something?
Bye
efgee