dsi_timer.hpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. This software is subject to the license described in the License.txt file
  3. included with this software distribution. You may not use this file except
  4. in compliance with this license.
  5. Copyright (c) Dynastream Innovations Inc. 2016
  6. All rights reserved.
  7. */
  8. #if !defined(DSI_TIMER_HPP)
  9. #define DSI_TIMER_HPP
  10. #include "types.h"
  11. #include "dsi_thread.h"
  12. //////////////////////////////////////////////////////////////////////////////////
  13. // Public Definitions
  14. //////////////////////////////////////////////////////////////////////////////////
  15. //////////////////////////////////////////////////////////////////////////////////
  16. // Public Class Prototypes
  17. //////////////////////////////////////////////////////////////////////////////////
  18. class DSITimer
  19. {
  20. private:
  21. DSI_THREAD_RETURN (*fnTimerFunc)(void *);
  22. void *pvTimerFuncParameter;
  23. BOOL bClosing;
  24. DSI_MUTEX stMutexCriticalSection;
  25. DSI_CONDITION_VAR stCondTimerWait;
  26. DSI_CONDITION_VAR stCondTimerThreadExit;
  27. DSI_THREAD_ID hTimerThread;
  28. BOOL bRecurring;
  29. ULONG ulInterval;
  30. static DSI_THREAD_RETURN TimerThreadStart(void *pvParameter_);
  31. void TimerThread(void);
  32. public:
  33. // Constuctor and Destructor
  34. DSITimer(DSI_THREAD_RETURN (*fnTimerFunc_)(void *) = (DSI_THREAD_RETURN(*)(void *))NULL, void *pvTimerFuncParameter_ = NULL, ULONG ulInterval_ = 0, BOOL bRecurring_ = FALSE);
  35. ~DSITimer();
  36. BOOL NoError(void);
  37. };
  38. #endif //DSI_TIMER_HPP