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.

123 lines
3.8 KiB

  1. /****************************************************************************/
  2. // aschafn.h
  3. //
  4. // Function prototypes for Scheduler API functions
  5. //
  6. // Copyright (C) 1996-2000 Microsoft Corporation
  7. /****************************************************************************/
  8. void RDPCALL SCH_Init(void);
  9. void RDPCALL SCH_UpdateShm(void);
  10. void RDPCALL SCH_ContinueScheduling(unsigned);
  11. /****************************************************************************/
  12. // SCH_Term
  13. /****************************************************************************/
  14. void RDPCALL SCH_Term(void)
  15. {
  16. }
  17. /****************************************************************************/
  18. // SCH_ShouldWeDoStuff
  19. //
  20. // Allow SCH to determine if TimeToDoStuff should pass on this IOCTL.
  21. /****************************************************************************/
  22. BOOL RDPCALL SCH_ShouldWeDoStuff(BOOL mustSend)
  23. {
  24. BOOL rc;
  25. schInTTDS = TRUE;
  26. if ((schCurrentMode == SCH_MODE_ASLEEP) && !mustSend) {
  27. // We've been called because of the first piece of output; don't do
  28. // any work this time round, but start accumulating.
  29. SCH_ContinueScheduling(SCH_MODE_NORMAL);
  30. rc = FALSE;
  31. }
  32. else {
  33. // If we're in normal mode, then set ourselves asleep: we'll only
  34. // stay awake if someone calls ContinueScheduling during this pass
  35. // of TimeToDoStuff.
  36. if (schCurrentMode == SCH_MODE_NORMAL)
  37. schCurrentMode = SCH_MODE_ASLEEP;
  38. rc = TRUE;
  39. }
  40. return rc;
  41. }
  42. /****************************************************************************/
  43. // SCH_EndOfDoingStuff
  44. //
  45. // Calculate the timer period to set; update the scheduling mode if required.
  46. // Returns time period in milliseconds to set desktop timer.
  47. /****************************************************************************/
  48. INT32 RDPCALL SHCLASS SCH_EndOfDoingStuff(PUINT32 pSchCurrentMode)
  49. {
  50. UINT32 currentTime;
  51. // Check for exiting TURBO mode.
  52. if (schCurrentMode == SCH_MODE_TURBO || schInputKickMode) {
  53. COM_GETTICKCOUNT(currentTime);
  54. if ((schCurrentMode == SCH_MODE_TURBO) &&
  55. ((currentTime - schLastTurboModeSwitch) > schTurboModeDuration))
  56. {
  57. schCurrentMode = SCH_MODE_NORMAL;
  58. }
  59. // InputKick Mode is set to TRUE when we get client keyboard or mouse
  60. // input, and set to FALSE here when a constant time-period since the
  61. // input has passed.
  62. if ((currentTime - schLastTurboModeSwitch) > SCH_INPUTKICK_DURATION) {
  63. schInputKickMode = FALSE;
  64. }
  65. }
  66. schInTTDS = FALSE;
  67. *pSchCurrentMode = schCurrentMode;
  68. return schPeriods[schCurrentMode];
  69. }
  70. /****************************************************************************/
  71. // SCH_UpdateBACompressionEst
  72. /****************************************************************************/
  73. void RDPCALL SCH_UpdateBACompressionEst(unsigned estimate)
  74. {
  75. m_pShm->sch.baCompressionEst = estimate;
  76. }
  77. /****************************************************************************/
  78. // SCH_GetBACompressionEst
  79. /****************************************************************************/
  80. unsigned RDPCALL SCH_GetBACompressionEst(void)
  81. {
  82. return m_pShm->sch.baCompressionEst;
  83. }
  84. /****************************************************************************/
  85. // SCH_GetCurrentMode
  86. /****************************************************************************/
  87. unsigned SCH_GetCurrentMode()
  88. {
  89. return schCurrentMode;
  90. }
  91. /****************************************************************************/
  92. // SCH_GetInputKickMode
  93. /****************************************************************************/
  94. BOOL SCH_GetInputKickMode()
  95. {
  96. return schInputKickMode;
  97. }