TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Timo Sirainen
from: David Muir
date: 1995-12-27 15:23:34
subject: Timeslices

-=> Quoting Timo Sirainen to All <=-

 TS> Can I give timeslices to OS/2 in OS/2 prog? Or how should I do this
 TS> kind of program: 
 TS> repeat
 TS> if keypressed then
 TS> begin
 TS> c:=readkey;
 TS> {...}
 TS> end else
 TS> begin
 TS> give_timeslice; { Any way to do this in OS/2 prog? }
 TS> end;
 TS> until quit;

    I see a message from Peter coming . try this

c:=readkey;

    This blocks your program in the read attempt and OS/2 will automaticaly 
take the time away from the program. By doing the above, you are
"constantly" 
doing something. To give up a timeslice "stop" doing something.

    but your "give_timeslice" would be functionally equivalent to
dossleep(1) 
which would give the minimum timeslice before returning to processing. However 
it should NOT be necessary if your code is blocked in hardware access 
(readkey).

In a quick test, the one readkey uses less resource than a loop which release 
time via dossleep.

Dave...

... Run, Don't Walk... to your FidoNet HUB for THDPRO Support.
~~~ TGWave v1.10+
--- GEcho 1.11+
* Origin: fks Online! * Ontario, Canada * (905)820-7273 * (1:259/423)
SEEN-BY: 270/101 620/243 711/401 409 410 413 430 808 809 934 955 712/407 515
SEEN-BY: 712/517 628 713/888 800/1 7877/2809
@PATH: 259/423 400 99 250/99 3615/50 396/1 270/101 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.