home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / wps / utils / memsz221 / process.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-14  |  959 b   |  46 lines

  1. // Class PROCESS: Encapsulates the startup/shutdown logic for a OS/2-PM process.
  2.  
  3. #define INCL_BASE
  4. #define INCL_WIN
  5. #include <os2.h>
  6.  
  7. #include "debug.h"
  8.  
  9. #include "process.h"
  10.  
  11.  
  12. // Constructor
  13.  
  14. Process::Process ( LONG QueueSize )
  15. {
  16.   DosError ( FERR_DISABLEEXCEPTION ) ;
  17.  
  18.   ExceptionRecord.prev_structure = 0 ;
  19.   ExceptionRecord.ExceptionHandler = ExceptionHandler ;
  20.   DosSetExceptionHandler ( &ExceptionRecord ) ;
  21.  
  22.   Anchor = WinInitialize ( 0 ) ;
  23.   if ( Anchor == 0 )
  24.   {
  25. //  Log ( "ERROR: Unable to initialize for windowing.\r\n" ) ;
  26.     DosExit ( EXIT_PROCESS, 1 ) ;
  27.   }
  28.  
  29.   Queue = WinCreateMsgQueue ( Anchor, QueueSize ) ;
  30.   if ( Queue == 0 )
  31.   {
  32. //  Log ( "ERROR: Unable to create process message queue.\r\n" ) ;
  33.     DosExit ( EXIT_PROCESS, 1 ) ;
  34.   }
  35. }
  36.  
  37.  
  38. // Destructor
  39.  
  40. Process::~Process ( )
  41. {
  42.   WinDestroyMsgQueue ( Queue ) ;
  43.   WinTerminate ( Anchor ) ;
  44.   DosUnsetExceptionHandler ( &ExceptionRecord ) ;
  45. }
  46.