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.

74 lines
1.3 KiB

  1. /*++
  2. Copyright (c) 1997-2000 Microsoft Corporation
  3. Module Name:
  4. Thread.h
  5. Abstract:
  6. Definitions for autorefresh thread management class.
  7. --*/
  8. #ifndef __THREAD_H
  9. #define __THREAD_H
  10. #include "rndcommc.h"
  11. #include "rndutil.h"
  12. //
  13. // Refresh table defs.
  14. //
  15. const long ILS_UPDATE_INTERVAL = 1800; // 30 minutes
  16. typedef struct
  17. {
  18. WCHAR * pDN;
  19. DWORD dwTTL;
  20. } RefreshTableEntry;
  21. typedef SimpleVector<RefreshTableEntry> RefreshTable;
  22. const DWORD TIMER_PERIOD = 60; // 60 seconds
  23. enum { EVENT_STOP = 0, EVENT_TIMER, NUM_EVENTS };
  24. class CRendThread
  25. {
  26. public:
  27. CRendThread()
  28. : m_hThread(NULL)
  29. {
  30. m_hEvents[EVENT_STOP] = NULL;
  31. m_hEvents[EVENT_TIMER] = NULL;
  32. }
  33. ~CRendThread();
  34. void Shutdown(void);
  35. HRESULT ThreadProc();
  36. HRESULT AddDirectory(ITDirectory *pdir);
  37. HRESULT RemoveDirectory(ITDirectory *pdir);
  38. private:
  39. void UpdateDirectories();
  40. BOOL StopThread() { return SetEvent(m_hEvents[EVENT_STOP]); }
  41. HRESULT Start();
  42. HRESULT Stop();
  43. private:
  44. CCritSection m_lock;
  45. HANDLE m_hThread;
  46. HANDLE m_hEvents[NUM_EVENTS];
  47. SimpleVector<ITDynamicDirectory*> m_Directories;
  48. };
  49. extern CRendThread g_RendThread;
  50. #endif