home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / PROGRAM / C / AETSK101 / TSKFATAL.CC < prev    next >
C/C++ Source or Header  |  1991-12-01  |  1KB  |  47 lines

  1. /**********************************************************************
  2.  *  
  3.  *  NAME:           tskfatal.cpp
  4.  *  
  5.  *  DESCRIPTION:    fatal error reporting function for multitasking
  6.  *                  scheduler:
  7.  *
  8.  *                  writes out the name of the current task, and the
  9.  *                  error message, then calls exit(1)
  10.  *
  11.  *                  the user is free to replace this routine by linking
  12.  *                  in a new function with the same name and argument
  13.  *                  list before linking the task library
  14.  *  
  15.  *  copyright (c) 1991 J. Alan Eldridge
  16.  * 
  17.  *  M O D I F I C A T I O N   H I S T O R Y
  18.  *
  19.  *  when        who                 what
  20.  *  -------------------------------------------------------------------
  21.  *  11/30/91    J. Alan Eldridge    created
  22.  *  
  23.  *********************************************************************/
  24.  
  25. #include    "aedef.h"
  26. #include    "task.h"
  27.  
  28.  
  29. //------------------------------------------------------------
  30. //  TaskFatal   -- report a message and die with call to exit(1)
  31. //------------------------------------------------------------
  32.  
  33. void TaskFatal(char *fmt, ...)
  34. {
  35.     va_list ap;
  36.     char    *tname = CurrTask ? CurrTask->name() : "NO TASK RUNNING";
  37.     
  38.     fprintf(stderr, "\nCurrTask <%s>: ", tname);
  39.  
  40.     va_start(ap, fmt);
  41.     vfprintf(stderr, fmt, ap);
  42.     va_end(ap);
  43.     
  44.     fprintf(stderr, "\n");
  45.     exit(1);
  46. }
  47.