SetPriorityClass: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: SetPriorityClass
| Old | New | Line | |
|---|---|---|---|
| 1 | + | SetPriorityClass - a function that sets the priority class for a specified process. This function is specific to Windows. | |
| 2 | + | ||
| 3 | + | The SetPriorityClass may have one of the following priority classes: | |
| 4 | + | ||
| 5 | + | - HIGH_PRIORITY_CLASS \<= High performs tasks immediately.\ | |
| 6 | + | - IDLE_PRIORITY_CLASS \<= Idle performs tasks when the system is idle.\ | |
| 7 | + | - NORMAL_PRIORITY_CLASS \<= Normal performs tasks at regular speed.\ | |
| 8 | + | - REALTIME_PRIORITY_CLASS \<= Real Time performs tasks immediately and above all other tasks, including operating system tasks. | |
| 9 | + | ||
| 10 | + | Use caution when using REALTIME_PRIORITY_CLASS. It can potentially take so much of the CPU resources that there may not be anything left for other items to run, including operating system requests. | |
| 11 | + | ||
| 12 | + | EXAMPLE: | |
| 13 | + | ||
| 14 | + | ``` pascal | |
| 15 | + | uses Windows; // Unit containing the SetPriorityClass function. | |
| 16 | + | ||
| 17 | + | procedure TForm1.FormCreate(Sender: TObject); | |
| 18 | + | begin | |
| 19 | + | SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); | |
| 20 | + | // Sets the current running application to High Priority. | |
| 21 | + | end; | |
| 22 | + | ``` | |
| 23 | + | ||
| 24 | + | --- | |
| 25 | + | *From the Free Pascal wiki, page "SetPriorityClass", as it stood on 2020-02-26 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
