index.d.ts 5.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* auto-generated by NAPI-RS */
  2. /* eslint-disable */
  3. /**
  4. * This function get the priority of the current process.
  5. * On Unix, it uses the [`getpriority(2)`](https://linux.die.net/man/2/getpriority).
  6. *
  7. * On Windows, it uses the [`GetThreadPriority`](https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getthreadpriority) function.
  8. *
  9. * | Priority Constant | Value | Description |
  10. * |------------------------------------|-----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
  11. * | THREAD_MODE_BACKGROUND_BEGIN | 0x00010000| Begin background processing mode. The system lowers the resource scheduling priorities of the thread so that it can perform background work without significantly affecting activity in the foreground. |
  12. * | | | This value can be specified only if hThread is a handle to the current thread. The function fails if the thread is already in background processing mode. |
  13. * | | | Windows Server 2003: This value is not supported. |
  14. * | THREAD_MODE_BACKGROUND_END | 0x00020000| End background processing mode. The system restores the resource scheduling priorities of the thread as they were before the thread entered background processing mode. |
  15. * | | | This value can be specified only if hThread is a handle to the current thread. The function fails if the thread is not in background processing mode. |
  16. * | | | Windows Server 2003: This value is not supported. |
  17. * | THREAD_PRIORITY_ABOVE_NORMAL | 1 | Priority 1 point above the priority class. |
  18. * | THREAD_PRIORITY_BELOW_NORMAL | -1 | Priority 1 point below the priority class. |
  19. * | THREAD_PRIORITY_HIGHEST | 2 | Priority 2 points above the priority class. |
  20. * | THREAD_PRIORITY_IDLE | -15 | Base priority of 1 for IDLE_PRIORITY_CLASS, BELOW_NORMAL_PRIORITY_CLASS, NORMAL_PRIORITY_CLASS, ABOVE_NORMAL_PRIORITY_CLASS, or HIGH_PRIORITY_CLASS processes, and a base priority of 16 for REALTIME_PRIORITY_CLASS processes. |
  21. * | THREAD_PRIORITY_LOWEST | -2 | Priority 2 points below the priority class. |
  22. * | THREAD_PRIORITY_NORMAL | 0 | Normal priority for the priority class. |
  23. * | THREAD_PRIORITY_TIME_CRITICAL | 15 | Base priority of 15 for IDLE_PRIORITY_CLASS, BELOW_NORMAL_PRIORITY_CLASS, NORMAL_PRIORITY_CLASS, ABOVE_NORMAL_PRIORITY_CLASS, or HIGH_PRIORITY_CLASS processes, and a base priority of 31 for REALTIME_PRIORITY_CLASS processes. |
  24. */
  25. export declare function getCurrentProcessPriority(): number
  26. /**
  27. * This function set the priority of the current process.
  28. * On Unix, it uses the [`nice`](https://linux.die.net/man/2/nice) function.
  29. *
  30. * On Windows, it uses the [`SetThreadPriority`](https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-setthreadpriority) function.
  31. */
  32. export declare function nice(incr?: number | undefined | null): number
  33. export declare const enum WindowsThreadPriority {
  34. ThreadModeBackgroundBegin = 65536,
  35. ThreadModeBackgroundEnd = 131072,
  36. ThreadPriorityAboveNormal = 1,
  37. ThreadPriorityBelowNormal = -1,
  38. ThreadPriorityHighest = 2,
  39. ThreadPriorityIdle = -15,
  40. ThreadPriorityLowest = -2,
  41. ThreadPriorityNormal = 0,
  42. ThreadPriorityTimeCritical = 15
  43. }