Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.3 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992-1995
  5. //
  6. // File: nteventc.hxx
  7. //
  8. // Contents: NT Event wrapper class
  9. //
  10. // History: 1-Sep-95 dlee Created
  11. //
  12. //---------------------------------------------------------------------------
  13. #pragma once
  14. //+---------------------------------------------------------------------------
  15. //
  16. // Class: CNTEvent
  17. //
  18. // Purpose: NT Event
  19. //
  20. // History: 1-Sep-95 dlee Created
  21. //
  22. //----------------------------------------------------------------------------
  23. class CNTEvent
  24. {
  25. public:
  26. CNTEvent( BOOL fSignalled = FALSE )
  27. {
  28. NTSTATUS Status = NtCreateEvent( &_hEvent,
  29. EVENT_ALL_ACCESS,
  30. 0,
  31. NotificationEvent,
  32. fSignalled );
  33. if ( FAILED( Status ) )
  34. THROW( CException( Status ) );
  35. }
  36. ~CNTEvent() { NtClose( _hEvent ); }
  37. HANDLE Get() { return _hEvent; }
  38. void Reset() { NtResetEvent( _hEvent, 0 ); }
  39. void Set() { NtSetEvent( _hEvent, 0 ); }
  40. private:
  41. HANDLE _hEvent;
  42. };