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.

69 lines
2.5 KiB

  1. #ifndef __REFTRCE2_H__
  2. #define __REFTRCE2_H__
  3. #if SERVICE_REF_TRACKING
  4. # include <reftrace.h>
  5. # define SHARED_LOG_REF_COUNT() \
  6. ( sm_pDbgRefTraceLog != NULL ) ? \
  7. WriteRefTraceLog( \
  8. sm_pDbgRefTraceLog \
  9. , m_reference \
  10. , this \
  11. ) \
  12. : -1 \
  13. //
  14. // This macro logs the IIS_SERVICE-specific ref trace log
  15. //
  16. # define LOCAL_LOG_REF_COUNT() \
  17. ( m_pDbgRefTraceLog != NULL ) ? \
  18. WriteRefTraceLog( \
  19. m_pDbgRefTraceLog \
  20. , m_reference \
  21. , this \
  22. ) \
  23. : -1 \
  24. //
  25. // Usage of above macros AFTER we decremented reference count
  26. // was unsafe. Under stress we would sometimes hit assert
  27. // in WriteTraceLog() because IIS_SERVICE::m_pDbgRefTraceLog
  28. // was no longer valid. This was due to a race condition where
  29. // another thread deletes IIS_SERVICE object while we are still
  30. // doing the log.
  31. // So, instead of using original macros AFTER the decrement
  32. // use modified macros BEFORE the decrement. This should
  33. // result in identical logs most of the time (subject to
  34. // race conditions and our guessing of what post decrement
  35. // reference count will be).
  36. //
  37. # define SHARED_EARLY_LOG_REF_COUNT() \
  38. ( sm_pDbgRefTraceLog != NULL ) ? \
  39. WriteRefTraceLog( \
  40. sm_pDbgRefTraceLog \
  41. , m_reference - 1 \
  42. , this \
  43. ) \
  44. : -1 \
  45. # define LOCAL_EARLY_LOG_REF_COUNT() \
  46. ( m_pDbgRefTraceLog != NULL ) ? \
  47. WriteRefTraceLog( \
  48. m_pDbgRefTraceLog \
  49. , m_reference - 1 \
  50. , this \
  51. ) \
  52. : -1 \
  53. #else // !SERVICE_REF_TRACKING
  54. # define SHARED_LOG_REF_COUNT() (-1)
  55. # define LOCAL_LOG_REF_COUNT() (-1)
  56. # define SHARED_EARLY_LOG_REF_COUNT() (-1)
  57. # define LOCAL_EARLY_LOG_REF_COUNT() (-1)
  58. #endif // !SERVICE_REF_TRACKING
  59. #endif // __REFTRCE2_H__