home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c070 / 4.ddi / TOOLS.4 / TCTSRC1.EXE / UTCRIT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-03-31  |  1.0 KB  |  46 lines

  1. /**
  2. *
  3. * Name        UTCRIT -- Obtain address of DOS critical section flag.
  4. *
  5. * Synopsis    utcrit();
  6. *
  7. * Description    This function loads the global variable b_critad
  8. *        with the address of the DOS critical section flag for
  9. *        use by UTDOSRDY and other functions.
  10. *
  11. *        The DOS critical section flag is a one-byte value
  12. *        indicating whether any DOS functions are in progress and
  13. *        therefore whether DOS services are available to an
  14. *        interrupting process.  The byte has a zero value when
  15. *        DOS services are available.
  16. *
  17. *        UTCRIT itself invokes DOS, so do NOT use it inside a
  18. *        hardware ISR.
  19. *
  20. * Returns    Nothing.
  21. *
  22. * Version    6.00 (C)Copyright Blaise Computing Inc.  1987,1989
  23. *
  24. **/
  25.  
  26.  
  27. #include <dos.h>
  28. #include <butil.h>
  29.  
  30. unsigned char far *b_critad = FARNIL;
  31.  
  32.  
  33. unsigned char far *utcrit()
  34. {
  35.     union  REGS  regs;
  36.     struct SREGS sregs;
  37.  
  38.     regs.x.ax = 0x3400;     /* DOS function number.            */
  39.  
  40.     int86x (UTDOSINT, ®s, ®s, &sregs);
  41.  
  42.     b_critad = uttofar (sregs.es, regs.x.bx, unsigned char);
  43.  
  44.     return (b_critad);
  45. }
  46.