Subj : ]
To   : Jasen Betts
From : Chris Hoppman
Date : Sun Dec 14 2003 04:56 pm

JB>  CH> For A := 0 to 100 do
JB>  CH>     begin
JB>  CH>      {Do some stuff here}
JB>  CH>      TimeSlice;
JB>  CH>     end;
btw.. TimeSlice; is a call to a procedure that does the timeslices.
If you would like I can echo back the accual timeslice procedure.
I was using a shortten version of the code. Just an example that cover
the point I was asking about.

JB> first off check the documentation for "timeslice"  I don't find it
JB> documented as a standard part of TP

Back in the day no, but for OS/2, DesqView, and Windows you should have
them. ( It's still isn't a standard call in TP,BP).  They are basicly calls
to registers in asm telling the OS exactly what you just told me.  That my
program isn't doing anything major and to release a time share to other
programs.

JB> OTOH if you want to delay for a long time there may be some sort of sleep
JB> procedure avaialable. (but your code suggests to me that you want to
JB> "do some stuff" between timeslices so probably you are doing it the best wa

Sleep(ms); is for delphi.

Delay(ms); is the part that will pause the program, but I don't want to do
that.  Plus, it is the part that gives the RTE 200 (Where the program on 233+
system will not run)..

Anyhow, after thinking about it. Here is another sample is better suitted for
what I am asking.

Program TestTimeSlices;
Uses CRT, DOS;
Type
 Tasker : (None,DesqView,Windows,OS2);

Var
 Ch     : Char;

procedure TimeSlice;
Begin
   case Tasker of
      None: asm
             int 28h
      end;
      DesqView: asm
             mov ax, 1000h
             int 15h
      end;
      Windows: asm
             mov ax, 1680h
             int 2Fh
      end;
      OS2: asm
             push dx
             xor dx, dx
             mov ax, 0
             sti
             hlt
             db 035h, 0Cah
             pop dx
      end;
   end;
end;

Begin
{I am not going to write out the code to detect the OS. So, I am going}
{to say it is windows}
Tasker := Tasker + Windows;
Repeat
  if keypressed then ch := readkey;
  TimeSlice;
Until Upcase(Ch) := Q;
Write('You pressed the key: ',Ch);
repeat TimeSlice; until keypressed ;

End.

--- Renegade v11-26.3 DOS
* Origin: The Titantic BBS Telnet - ttb.slyip.com (1:129/305)