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.

76 lines
1.8 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1993.
  5. //
  6. // File: queue.h
  7. //
  8. // Contents:
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. // History: 01-05-96 NimishK Created
  15. //
  16. //----------------------------------------------------------------------------
  17. #ifndef __QUEUE_H__
  18. #define __QUEUE_H__
  19. //
  20. // A SORTED_QUEUE is a
  21. #define PRETRY_HASH_ENTRY CRETRY_HASH_ENTRY*
  22. class CRETRY_HASH_ENTRY;
  23. class CRETRY_Q
  24. {
  25. private :
  26. LIST_ENTRY m_QHead; // List pointers
  27. CRITICAL_SECTION m_CritSec; // Guard
  28. BOOL m_fCritSecInit; // Has init been called
  29. public:
  30. CRETRY_Q () //initialize stuff that can't fail
  31. {
  32. TraceFunctEnterEx((LPARAM)this, "CRETRY_Q::CRETRY_Q");
  33. m_fCritSecInit = FALSE;
  34. TraceFunctLeaveEx((LPARAM)this);
  35. }
  36. ~CRETRY_Q ()
  37. {
  38. TraceFunctEnterEx((LPARAM)this, "CRETRY_Q::~CRETRY_Q");
  39. TraceFunctLeaveEx((LPARAM)this);
  40. }
  41. HRESULT Initialize(void);
  42. HRESULT DeInitialize(void);
  43. static CRETRY_Q * CreateQueue(void);
  44. public :
  45. //for controlling the retry queue
  46. void LockQ () {EnterCriticalSection (&m_CritSec);}
  47. void UnLockQ() {LeaveCriticalSection (&m_CritSec);}
  48. LIST_ENTRY* GetQHead(){return &m_QHead;}
  49. void PrintAllEntries(void);
  50. void InsertSortedIntoQueue(PRETRY_HASH_ENTRY pHashEntry, BOOL *fTopOfQueue);
  51. BOOL RemoveFromQueue(PRETRY_HASH_ENTRY pRHEntry);
  52. PRETRY_HASH_ENTRY RemoveFromTop(void);
  53. BOOL CanRETRYHeadEntry(PRETRY_HASH_ENTRY *ppRHEntry, DWORD* dwDelay);
  54. BOOL IsQueueEmpty(void) const {return IsListEmpty(&m_QHead);}
  55. //Used to steal entries with tmp queue
  56. void StealQueueEntries(CRETRY_Q *pRetryQueue);
  57. };
  58. #endif