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.

123 lines
3.8 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1995.
  5. //
  6. // File: abktize.hxx
  7. //
  8. // Contents: A class capable of doing asynchronous bucket->window
  9. // expansion. It can be queued as a work item. For synchronous
  10. // bucket->window conversions, it can be called from the client
  11. // thread itself.
  12. //
  13. // Classes: CAsyncBucketExploder
  14. //
  15. // History: 5-25-95 srikants Created
  16. //
  17. //----------------------------------------------------------------------------
  18. #pragma once
  19. #include <worker.hxx>
  20. #include <segmru.hxx>
  21. class CLargeTable;
  22. class CTableBucket;
  23. class CQAsyncExecute;
  24. const LONGLONG eSigCAsyncBucketExploder = 0x74656b6375424151i64; // "QABucket"
  25. //+---------------------------------------------------------------------------
  26. //
  27. // Class: CAsyncBucketExploder
  28. //
  29. // Purpose: To co-ordinate the bucket->explosion between the query
  30. // object and the large table. It can be a work item on the
  31. // work queue.
  32. //
  33. // History: 5-25-95 srikants Created
  34. //
  35. // Notes: To prevent a deadlock, NEVER hold the lock on this object
  36. // and then call into the large table methods.
  37. //
  38. //----------------------------------------------------------------------------
  39. class CAsyncBucketExploder : INHERIT_VIRTUAL_UNWIND, public CDoubleLink, public PWorkItem
  40. {
  41. INLINE_UNWIND( CAsyncBucketExploder )
  42. public:
  43. CAsyncBucketExploder( CLargeTable & largeTable,
  44. XPtr<CTableBucket>& xBucket,
  45. WORKID widToPin,
  46. BOOL fDoWidToPath );
  47. virtual ~CAsyncBucketExploder();
  48. //
  49. // virtual methods from PWorkItem
  50. //
  51. void DoIt( CWorkThread * PThread );
  52. void AddRef();
  53. void Release();
  54. //
  55. // Called when the query is being aborted to release the workitem
  56. // from the work queue.
  57. //
  58. void Abort();
  59. //
  60. // Giving the query object to use for bucket->window conversion.
  61. //
  62. void SetQuery( CQAsyncExecute * pQExecute );
  63. //
  64. // Called to add this item to query's work queue.
  65. //
  66. void AddToWorkQueue();
  67. void WaitForCompletion()
  68. {
  69. _evt.Wait();
  70. }
  71. void SetOnLTList();
  72. WORKID GetWorkIdToPin() const { return _widToPin; }
  73. NTSTATUS GetStatus() const { return _status; }
  74. # ifdef CIEXTMODE
  75. void CiExtDump(void *ciExtSelf);
  76. # endif
  77. private:
  78. CLargeTable & _largeTable; // LargeTable that is driving the
  79. // bucket to window conversion.
  80. CTableBucket * _pBucket; // The bucket to be expanded.
  81. WORKID _widToPin; // WORKID that is pinned for this
  82. // expansion.
  83. BOOL _fDoWidToPath; // TRUE if Wid-to-path expansion needed
  84. CQAsyncExecute * _pQueryExecute; // The query object that will be used
  85. // to explode the bucket.
  86. LONG _refCount;
  87. CEventSem _evt; // Event for notifying the completion
  88. // or abort of the conversion.
  89. CMutexSem _mutex; // Mutex for serialization.
  90. BOOL _fOnWorkQueue; // Set to TRUE when this object is on
  91. // the work queue.
  92. BOOL _fOnLTList; // Set to TRUE when this object is on
  93. // the large table's list of exploding
  94. // buckets.
  95. NTSTATUS _status; // Status of the operation.
  96. };
  97. typedef class TDoubleList<CAsyncBucketExploder> CAsyncBucketsList;
  98. typedef class TFwdListIter<CAsyncBucketExploder, CAsyncBucketsList> CFwdAsyncBktsIter;