Leaked source code of windows server 2003
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.

63 lines
1.2 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1999, Microsoft Corp. All rights reserved.
  4. //
  5. // FILE
  6. //
  7. // sockevt.h
  8. //
  9. // SYNOPSIS
  10. //
  11. // Declares the class SocketEvent.
  12. //
  13. // MODIFICATION HISTORY
  14. //
  15. // 02/12/1999 Original version.
  16. //
  17. ///////////////////////////////////////////////////////////////////////////////
  18. #ifndef _SOCKEVT_H_
  19. #define _SOCKEVT_H_
  20. #if _MSC_VER >= 1000
  21. #pragma once
  22. #endif
  23. #include <winsock2.h>
  24. ///////////////////////////////////////////////////////////////////////////////
  25. //
  26. // CLASS
  27. //
  28. // SocketEvent
  29. //
  30. // DESCRIPTION
  31. //
  32. // Creates a socket that acts like a Win32 event. Useful for knocking a
  33. // thread out of select.
  34. //
  35. ///////////////////////////////////////////////////////////////////////////////
  36. class SocketEvent
  37. {
  38. public:
  39. SocketEvent() throw ()
  40. : s(INVALID_SOCKET)
  41. { }
  42. ~SocketEvent() throw ()
  43. { finalize(); }
  44. DWORD initialize() throw ();
  45. void finalize() throw ();
  46. DWORD set() throw ();
  47. void reset() throw ();
  48. operator SOCKET() throw ()
  49. { return s; }
  50. private:
  51. SOCKET s;
  52. sockaddr_in sin;
  53. };
  54. #endif // _SOCKEVT_H_