home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / slice.zip / TEST.C < prev   
C/C++ Source or Header  |  1993-10-18  |  848b  |  49 lines

  1. /*
  2.  * TEST.C
  3.  *
  4.  * Stupid test-bed for the time-slicing functions in SLICE.ASM;
  5.  * simply detects a multi-tasker and then waits for a keystroke
  6.  * twice, once with time-slicing and once without.
  7.  */
  8.  
  9. #include <stdio.h>
  10. #include <stdlib.h>
  11. #include <string.h>
  12. #include <conio.h>
  13.  
  14.  
  15. #include "slice.h"
  16.  
  17. static char *tasker_names[] =
  18. {
  19.     "None",
  20.     "DesqView",
  21.     "Windows 3.x (enhanced)",
  22.     "OS/2 2.0",
  23.     "OS/2 2.1 or higher"
  24. };
  25.  
  26. void main(void)
  27. {
  28.     int tasker = detect_multitasker();
  29.  
  30.     printf("Multitasker found: %s\r\n", tasker_names[tasker]);
  31.  
  32.     if (!tasker)
  33.         exit(1);
  34.  
  35.     puts("Waiting for keystroke (no slicing...)");
  36.     while (!kbhit())
  37.         ;
  38.  
  39.     getch();
  40.  
  41.     puts("Waiting for keystroke (slicing...)");
  42.     while (!kbhit())
  43.         timeslice();
  44.  
  45.     getch();
  46.  
  47.     exit(0);
  48. }
  49.