home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / aspisrc.zip / close.c < prev    next >
C/C++ Source or Header  |  1998-11-29  |  1KB  |  42 lines

  1. #include <devhelp.h>
  2. #include <devdebug.h>
  3. #include <devtype.h>
  4. #include <devrp.h>
  5. #include "aspiRout.h"
  6.  
  7.  
  8. #if defined(DEBUG)
  9.  
  10. static const char* MSG_CLOSE     = "Watcom Sample Device Driver Close";
  11.  
  12. #else
  13.  
  14. #define            MSG_CLOSE      0
  15.  
  16. #endif // DEBUG
  17.  
  18. WORD16 StratClose(RP FAR* _rp)
  19.   {
  20.    RPIOCtl FAR* rp = (RPIOCtl FAR*)_rp;
  21.   // This command should shutdown any hardware devices that were setup
  22.   // during the initialization stage.  Also, this command should free
  23.   // any resources that the driver owns.
  24.   // Print a message to the debug terminal saying when shutdown
  25.   cdbg << SKELETON;
  26.   cdbg << MSG_CLOSE << hex << setw(4);
  27.   cdbg << setw() << setb() << endl;
  28.   WORD16 result;
  29.   //close event semaphore
  30.   result=DevEventClose(postSema);
  31. #if defined(DEBUG)
  32.   cdbg << "Semaphore closed with return code " << result << endl;
  33.   cdbg << "trying to unlock segment... with LockHandle " << hex << (WORD32)LockHandle << endl;
  34. #endif
  35.   result=DevSegUnlock(LockHandle);
  36. #if defined(DEBUG)
  37.   cdbg << "DevSegUnlock returned with " << result << endl;
  38. #endif
  39.  
  40.   return RPDONE;
  41.   }
  42.