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.

81 lines
1.5 KiB

  1. //***************************************************************************
  2. //
  3. // File:
  4. //
  5. // Module: MS SNMP Provider
  6. //
  7. // Purpose:
  8. //
  9. // Copyright (c) 1997-2001 Microsoft Corporation, All Rights Reserved
  10. //
  11. //***************************************************************************
  12. /*
  13. * CTHREAD.CPP
  14. *
  15. * Implemenations of the derived thread classed used in notification.
  16. */
  17. #include <precomp.h>
  18. #include "csmir.h"
  19. #include "smir.h"
  20. #include "handles.h"
  21. #include "classfac.h"
  22. #include <textdef.h>
  23. #include "enum.h"
  24. #ifdef ICECAP_PROFILE
  25. #include <icapexp.h>
  26. #endif
  27. SCODE CNotifyThread :: Process()
  28. {
  29. BOOL bEvent = FALSE;
  30. while(TRUE)
  31. {
  32. DWORD dwResult = Wait(SMIR_CHANGE_INTERVAL);
  33. if(WAIT_EVENT_0 == dwResult)
  34. {
  35. bEvent = TRUE;
  36. }
  37. else if(WAIT_EVENT_TERMINATED == dwResult)
  38. {
  39. return SMIR_THREAD_EXIT;
  40. }
  41. else if( (dwResult == WAIT_TIMEOUT) && bEvent)
  42. {
  43. bEvent = FALSE;
  44. IConnectionPoint *pNotifyCP;
  45. CSmir::sm_ConnectionObjects->FindConnectionPoint(IID_ISMIR_Notify, &pNotifyCP);
  46. ((CSmirNotifyCP*)pNotifyCP)->TriggerEvent();
  47. pNotifyCP->Release();
  48. SetEvent(m_doneEvt);
  49. break;
  50. }
  51. }
  52. return SMIR_THREAD_EXIT;
  53. }
  54. CNotifyThread :: CNotifyThread(HANDLE* evtsarray, ULONG arraylen):CThread()
  55. {
  56. //addref the smir for this thread
  57. m_doneEvt = evtsarray[arraylen-1];
  58. //add the events
  59. for (ULONG i = 0; i < (arraylen - 1); i++)
  60. {
  61. AddEvent(evtsarray[i]);
  62. }
  63. }
  64. CNotifyThread :: ~CNotifyThread()
  65. {
  66. }