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.

117 lines
2.9 KiB

  1. /*++
  2. Copyright (c) 1995-1996 Microsoft Corporation
  3. Module Name :
  4. issched.hxx
  5. Abstract:
  6. This header file declares schedulable work item and functions for
  7. scheduling work items. These work items execute (once or periodically)
  8. on a set of worker threads maintained by the scheduler
  9. Author:
  10. Murali R. Krishnan ( MuraliK ) 31-July-1995
  11. Environment:
  12. Win32 -- User Mode
  13. Project:
  14. Internet Information Services RunTime Library DLL
  15. Revision History:
  16. --*/
  17. # ifndef _ISSCHED_HXX_
  18. # define _ISSCHED_HXX_
  19. /************************************************************
  20. * Include Headers
  21. ************************************************************/
  22. # include <windows.h>
  23. # include <timer.h>
  24. /************************************************************
  25. * Type Definitions
  26. ************************************************************/
  27. //
  28. // The callback functions you provide must have this signature
  29. //
  30. typedef
  31. VOID
  32. (WINAPI * PFN_SCHED_CALLBACK)(
  33. IN OUT PVOID pContext
  34. );
  35. //
  36. // Typically, you use the Scheduler like this:
  37. // g_dwCookie = ScheduleWorkItem(MyCallback, &ctxt, 30 * 1000);
  38. //
  39. // VOID
  40. // MyCallback(
  41. // VOID* pvContext)
  42. // {
  43. // g_dwCookie = 0; // free the cookie
  44. // CContext* pctxt = (CContext*) pvContext;
  45. // // whatever...
  46. // }
  47. //
  48. // If you need to cleanup, possibly before the scheduler has been
  49. // called, do this
  50. // if (g_dwCookie != 0)
  51. // {
  52. // RemoveWorkItem(g_dwCookie);
  53. // g_dwCookie = 0;
  54. // }
  55. // Effective with IIS 5.0, the scheduler is part of the IISRTL module.
  56. // IISRTL takes care of init/cleanup business of the scheduler, but you
  57. // must make sure to call InitializeIISRTL() and TerminateIISRTL() from
  58. // your own code if you want to use the scheduler APIs. Note: these
  59. // initialization/termination routines must *not* be called from your DllMain
  60. // if you want to avoid deadlocks. (DllMains are not re-entrant, so you cannot
  61. // create or shut down threads within them.)
  62. // Schedule a work item. For COM uses, note that the worker thread has been
  63. // CoInitialized as COINIT_MULTITHREADED. Returns a unique cookie that can
  64. // be used as the parameter to ScheduleAdjustTime and RemoveWorkItem.
  65. DWORD
  66. WINAPI
  67. ScheduleWorkItem(
  68. IN PFN_SCHED_CALLBACK pfnCallback,
  69. IN PVOID pContext,
  70. IN DWORD msecTimeInterval, // delta
  71. IN BOOL fPeriodic = FALSE
  72. );
  73. // Adjust the execution time of an already-scheduled workitem
  74. DWORD
  75. WINAPI
  76. ScheduleAdjustTime(
  77. IN DWORD dwCookie, // as returned by ScheduleWorkItem
  78. IN DWORD msecNewTime // delta
  79. );
  80. BOOL
  81. WINAPI
  82. RemoveWorkItem(
  83. IN DWORD dwCookie // as returned by ScheduleWorkItem
  84. );
  85. # endif // _ISSCHED_HXX_
  86. /************************ End of File ***********************/