home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 362_01 / test3.c < prev    next >
C/C++ Source or Header  |  1991-12-11  |  1KB  |  44 lines

  1. /*****************************************************************************
  2.  *                    test3.c                     *
  3.  *****************************************************************************
  4.  * DESCRIPTION:    Verification routine for the RMAXTask multitasking system.   *
  5.  *                                         *
  6.  *        Simple check of timed delays.                     *
  7.  *                                         *
  8.  * REVISIONS:     3 JUL 90 - RAC - Original code                     *
  9.  *****************************************************************************/
  10.  
  11. #include    <stdio.h>
  12. #include    <dos.h>
  13. #include    "\rmaxtask\source\rmaxtask.h"
  14.  
  15. int    break_handler() {
  16.     stop_RMAXTask();                /* Do 'about to die' cleanup */
  17.     printf("\nCtrl-Break pressed.  Program terminated.\n");
  18.     return 0;                    /* This will abort program */
  19.     }                        /* End break_handler() */
  20.  
  21. void tt() {
  22.     for (;;) {
  23.     suspend(18);
  24.     printf("TICK ");
  25.     suspend(18);
  26.     printf("TOCK ");
  27.     }
  28.     }    
  29.     
  30. void main() {
  31.  
  32.     int        i;                /* Generic temp */
  33.  
  34.     start_RMAXTask();
  35.     ctrlbrk(break_handler);            /* Establish break handler */
  36.     create_task("tt", tt, STANDARD_PRIORITY, STANDARD_STACK);
  37.     for (i=1; i<=8; i++) {
  38.     printf("\nSuspending for %d seconds ", i);
  39.     suspend(18 * i);
  40.     }    
  41.     stop_RMAXTask();                /*  a key is pressed */
  42.     printf("\nDone with main task.\n");
  43.     }
  44.