Changeset 491
- Timestamp:
- 11/10/2008 10:01:23 AM (5 years ago)
- Location:
- branches/eraser6
- Files:
-
- 2 edited
-
Manager/DirectExecutor.cs (modified) (2 diffs)
-
Util/KernelAPI.cs (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/Manager/DirectExecutor.cs
r488 r491 293 293 try 294 294 { 295 //Prevent the system from sleeping. 296 KernelAPI.SetThreadExecutionState(KernelAPI.EXECUTION_STATE.ES_CONTINUOUS | 297 KernelAPI.EXECUTION_STATE.ES_SYSTEM_REQUIRED); 298 295 299 //Broadcast the task started event. 296 300 task.queued = false; … … 332 336 finally 333 337 { 338 //Allow the system to sleep again. 339 KernelAPI.SetThreadExecutionState(KernelAPI.EXECUTION_STATE.ES_CONTINUOUS | 340 KernelAPI.EXECUTION_STATE.ES_SYSTEM_REQUIRED); 341 334 342 //If the task is a recurring task, reschedule it since we are done. 335 343 if (task.Schedule is RecurringSchedule) -
branches/eraser6/Util/KernelAPI.cs
r461 r491 301 301 /// </summary> 302 302 private ulong ullAvailExtendedVirtual; 303 304 public override int GetHashCode() 305 { 306 throw new NotImplementedException(); 307 } 308 309 public override bool Equals(Object obj) 310 { 311 throw new NotImplementedException(); 312 } 313 314 public static bool operator ==(MEMORYSTATUSEX x, MEMORYSTATUSEX y) 315 { 316 throw new NotImplementedException(); 317 } 318 319 public static bool operator !=(MEMORYSTATUSEX x, MEMORYSTATUSEX y) 320 { 321 throw new NotImplementedException(); 322 } 323 } 303 } 324 304 325 305 /// <summary> … … 433 413 /// </summary> 434 414 public ushort processorRevision; 435 436 public override int GetHashCode() 437 { 438 throw new NotImplementedException(); 439 } 440 441 public override bool Equals(Object obj) 442 { 443 throw new NotImplementedException(); 444 } 445 446 public static bool operator ==(SYSTEM_INFO x, SYSTEM_INFO y) 447 { 448 throw new NotImplementedException(); 449 } 450 451 public static bool operator !=(SYSTEM_INFO x, SYSTEM_INFO y) 452 { 453 throw new NotImplementedException(); 454 } 455 } 415 } 456 416 457 417 /// <summary> … … 613 573 /// </summary> 614 574 public IntPtr hStdError; 615 616 public override int GetHashCode() 617 { 618 throw new NotImplementedException(); 619 } 620 621 public override bool Equals(Object obj) 622 { 623 throw new NotImplementedException(); 624 } 625 626 public static bool operator ==(STARTUPINFO x, STARTUPINFO y) 627 { 628 throw new NotImplementedException(); 629 } 630 631 public static bool operator !=(STARTUPINFO x, STARTUPINFO y) 632 { 633 throw new NotImplementedException(); 634 } 635 } 575 } 576 577 /// <summary> 578 /// Enables an application to inform the system that it is in use, thereby 579 /// preventing the system from entering sleep or turning off the display 580 /// while the application is running. 581 /// </summary> 582 /// <param name="esFlags">The thread's execution requirements. This parameter 583 /// can be one or more of the EXECUTION_STATE values.</param> 584 /// <returns>If the function succeeds, the return value is the previous 585 /// thread execution state. 586 /// 587 /// If the function fails, the return value is NULL.</returns> 588 /// <remarks>The system automatically detects activities such as local keyboard 589 /// or mouse input, server activity, and changing window focus. Activities 590 /// that are not automatically detected include disk or CPU activity and 591 /// video display. 592 /// 593 /// Calling SetThreadExecutionState without ES_CONTINUOUS simply resets 594 /// the idle timer; to keep the display or system in the working state, 595 /// the thread must call SetThreadExecutionState periodically. 596 /// 597 /// To run properly on a power-managed computer, applications such as fax 598 /// servers, answering machines, backup agents, and network management 599 /// applications must use both ES_SYSTEM_REQUIRED and ES_CONTINUOUS when 600 /// they process events. Multimedia applications, such as video players 601 /// and presentation applications, must use ES_DISPLAY_REQUIRED when they 602 /// display video for long periods of time without user input. Applications 603 /// such as word processors, spreadsheets, browsers, and games do not need 604 /// to call SetThreadExecutionState. 605 /// 606 /// The ES_AWAYMODE_REQUIRED value should be used only when absolutely 607 /// necessary by media applications that require the system to perform 608 /// background tasks such as recording television content or streaming media 609 /// to other devices while the system appears to be sleeping. Applications 610 /// that do not require critical background processing or that run on 611 /// portable computers should not enable away mode because it prevents 612 /// the system from conserving power by entering true sleep. 613 /// 614 /// To enable away mode, an application uses both ES_AWAYMODE_REQUIRED and 615 /// ES_CONTINUOUS; to disable away mode, an application calls 616 /// SetThreadExecutionState with ES_CONTINUOUS and clears 617 /// ES_AWAYMODE_REQUIRED. When away mode is enabled, any operation that 618 /// would put the computer to sleep puts it in away mode instead. The computer 619 /// appears to be sleeping while the system continues to perform tasks that 620 /// do not require user input. Away mode does not affect the sleep idle 621 /// timer; to prevent the system from entering sleep when the timer expires, 622 /// an application must also set the ES_SYSTEM_REQUIRED value. 623 /// 624 /// The SetThreadExecutionState function cannot be used to prevent the user 625 /// from putting the computer to sleep. Applications should respect that 626 /// the user expects a certain behavior when they close the lid on their 627 /// laptop or press the power button. 628 /// 629 /// This function does not stop the screen saver from executing. 630 /// </remarks> 631 [DllImport("Kernel32.dll")] 632 public static extern EXECUTION_STATE SetThreadExecutionState(EXECUTION_STATE esFlags); 633 634 /// <summary> 635 /// Execution state values to be used in conjuction with SetThreadExecutionState 636 /// </summary> 637 public enum EXECUTION_STATE : uint 638 { 639 /// <summary> 640 /// Enables away mode. This value must be specified with ES_CONTINUOUS. 641 /// 642 /// Away mode should be used only by media-recording and media-distribution 643 /// applications that must perform critical background processing on 644 /// desktop computers while the computer appears to be sleeping. 645 /// See remarks. 646 /// 647 /// Windows Server 2003 and Windows XP/2000: ES_AWAYMODE_REQUIRED is 648 /// not supported. 649 /// </summary> 650 ES_AWAYMODE_REQUIRED = 0x00000040, 651 652 /// <summary> 653 /// Informs the system that the state being set should remain in effect 654 /// until the next call that uses ES_CONTINUOUS and one of the other 655 /// state flags is cleared. 656 /// </summary> 657 ES_CONTINUOUS = 0x80000000, 658 659 /// <summary> 660 /// Forces the display to be on by resetting the display idle timer. 661 /// </summary> 662 ES_DISPLAY_REQUIRED = 0x00000002, 663 664 /// <summary> 665 /// Forces the system to be in the working state by resetting the system 666 /// idle timer. 667 /// </summary> 668 ES_SYSTEM_REQUIRED = 0x00000001, 669 670 /// <summary> 671 /// This value is not supported. If ES_USER_PRESENT is combined with 672 /// other esFlags values, the call will fail and none of the specified 673 /// states will be set. 674 /// 675 /// Windows Server 2003 and Windows XP/2000: Informs the system that a 676 /// user is present and resets the display and system idle timers. 677 /// ES_USER_PRESENT must be called with ES_CONTINUOUS. 678 /// </summary> 679 ES_USER_PRESENT = 0x00000004 680 } 636 681 } 637 682 }
Note: See TracChangeset
for help on using the changeset viewer.
