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.

114 lines
2.1 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name :
  4. UlDisconnect.hxx
  5. Abstract:
  6. Async context for disconnect notification
  7. Author:
  8. Bilal Alam (balam) 7-Jan-2000
  9. Environment:
  10. Win32 - User Mode
  11. Project:
  12. IIS Worker Process (web service)
  13. --*/
  14. #ifndef _ULDISCONNECT_HXX_
  15. #define _ULDISCONNECT_HXX_
  16. #include "asynccontext.hxx"
  17. #include <acache.hxx>
  18. #define UL_DISCONNECT_SIGNATURE CREATE_SIGNATURE( 'ULDs')
  19. #define UL_DISCONNECT_SIGNATURE_FREE CREATE_SIGNATURE( 'ulds')
  20. class UL_DISCONNECT_CONTEXT : public ASYNC_CONTEXT
  21. {
  22. public:
  23. UL_DISCONNECT_CONTEXT(
  24. PVOID pvContext
  25. )
  26. {
  27. _pvContext = pvContext;
  28. _dwSignature = UL_DISCONNECT_SIGNATURE;
  29. InterlockedIncrement( &sm_cOutstanding );
  30. }
  31. ~UL_DISCONNECT_CONTEXT(
  32. VOID
  33. )
  34. {
  35. InterlockedDecrement( &sm_cOutstanding );
  36. _dwSignature = UL_DISCONNECT_SIGNATURE_FREE;
  37. }
  38. static
  39. VOID
  40. WaitForOutstandingDisconnects(
  41. VOID
  42. );
  43. static
  44. HRESULT
  45. Initialize(
  46. VOID
  47. );
  48. static
  49. VOID
  50. Terminate(
  51. VOID
  52. );
  53. VOID
  54. DoWork(
  55. DWORD cbData,
  56. DWORD dwError,
  57. LPOVERLAPPED lpo
  58. );
  59. BOOL
  60. CheckSignature(
  61. VOID
  62. ) const
  63. {
  64. return _dwSignature == UL_DISCONNECT_SIGNATURE;
  65. }
  66. VOID *
  67. operator new(
  68. size_t size
  69. )
  70. {
  71. DBG_ASSERT( size == sizeof( UL_DISCONNECT_CONTEXT ) );
  72. DBG_ASSERT( sm_pachDisconnects != NULL );
  73. return sm_pachDisconnects->Alloc();
  74. }
  75. VOID
  76. operator delete(
  77. VOID * pUlDisconnect
  78. )
  79. {
  80. DBG_ASSERT( pUlDisconnect != NULL );
  81. DBG_ASSERT( sm_pachDisconnects != NULL );
  82. DBG_REQUIRE( sm_pachDisconnects->Free( pUlDisconnect ) );
  83. }
  84. private:
  85. DWORD _dwSignature;
  86. PVOID _pvContext;
  87. static LONG sm_cOutstanding;
  88. static ALLOC_CACHE_HANDLER* sm_pachDisconnects;
  89. };
  90. #endif