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.

53 lines
2.3 KiB

  1. /*==========================================================================
  2. *
  3. * Copyright (C) 1998-2002 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: mytimer.h
  6. * Content: This file contains code for the Protocol's timers
  7. *
  8. * History:
  9. * Date By Reason
  10. * ==== == ======
  11. * 06/04/98 aarono Original
  12. * 07/01/00 masonb Assumed Ownership
  13. * 06/25/02 simonpow Modified to use inline functions calling into the standard threadpool
  14. *
  15. ****************************************************************************/
  16. #pragma TODO(vanceo, "Select CPU for these functions")
  17. //N.B. The 3rd param for ScheduleProtocolTimer and RescheduleProtocolTimer (the unused DWORD) takes the accuracy
  18. //we require for the timer. This isn't supported in the current thread pool, but I've left the option there in case we ever
  19. //implement this functionality
  20. inline HRESULT ScheduleProtocolTimer(PSPD pSPD, DWORD dwDelay, DWORD , const PFNDPTNWORKCALLBACK pfnWorkCallback,
  21. void * pvCallbackContext, void ** ppvTimerData, UINT *const pdwTimerUnique)
  22. {
  23. #ifndef DPNBUILD_NOPROTOCOLTESTITF
  24. if (pSPD->pPData->ulProtocolFlags & PFLAGS_FAIL_SCHEDULE_TIMER)
  25. return DPNERR_OUTOFMEMORY;
  26. #endif
  27. return IDirectPlay8ThreadPoolWork_ScheduleTimer(pSPD->pPData->pDPThreadPoolWork,
  28. -1, dwDelay, pfnWorkCallback, pvCallbackContext, ppvTimerData, pdwTimerUnique, 0);
  29. }
  30. inline HRESULT RescheduleProtocolTimer(PSPD pSPD, void * pvTimerData, DWORD dwDelay, DWORD,
  31. const PFNDPTNWORKCALLBACK pfnWorkCallback, void * pvCallbackContext, UINT *const pdwTimerUnique)
  32. {
  33. return IDirectPlay8ThreadPoolWork_ResetCompletingTimer(pSPD->pPData->pDPThreadPoolWork, pvTimerData,
  34. dwDelay, pfnWorkCallback, pvCallbackContext, pdwTimerUnique, 0);
  35. }
  36. inline HRESULT CancelProtocolTimer(PSPD pSPD, void * pvTimerData, DWORD dwTimerUnique)
  37. {
  38. return IDirectPlay8ThreadPoolWork_CancelTimer(pSPD->pPData->pDPThreadPoolWork, pvTimerData, dwTimerUnique, 0);
  39. }
  40. inline HRESULT ScheduleProtocolWork(PSPD pSPD, const PFNDPTNWORKCALLBACK pfnWorkCallback,
  41. void * const pvCallbackContext)
  42. {
  43. return IDirectPlay8ThreadPoolWork_QueueWorkItem(pSPD->pPData->pDPThreadPoolWork, -1,
  44. pfnWorkCallback, pvCallbackContext, 0);
  45. }