Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@napi-rs/nice

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@napi-rs/nice

https://linux.die.net/man/2/nice binding for Node.js

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
767K
increased by14.53%
Maintainers
0
Weekly downloads
 
Created
Source

@napi-rs/nice

https://github.com/Brooooooklyn/nice/actions install size Downloads

🚀 Help me to become a full-time open-source developer by sponsoring me on Github

https://linux.die.net/man/2/nice binding for Node.js

Usage

Install this test package

pnpm add @napi-rs/nice

or

yarn add @napi-rs/nice

or

npm install @napi-rs/nice

nice

On Unix, nice() adds inc to the nice value for the calling process. (A higher nice value means a low priority.) Only the superuser may specify a negative increment, or priority increase. The range for nice values is described in getpriority(2).

On Windows, it uses the SetThreadPriority function.

// on Unix
import { nice } from '@napi-rs/nice'

nice(2)
// on Windows
import { nice, WindowsThreadPriority } from '@napi-rs/nice'

nice(WindowsThreadPriority.THREAD_PRIORITY_ABOVE_NORMAL)

getCurrentProcessPriority

This function gets the priority of the current process. On Unix, it uses the getpriority(2).

On Windows, it uses the GetThreadPriority function.

Priority ConstantValueDescription
THREAD_MODE_BACKGROUND_BEGIN0x00010000Begin 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.
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.
Windows Server 2003: This value is not supported.
THREAD_MODE_BACKGROUND_END0x00020000End background processing mode. The system restores the resource scheduling priorities of the thread as they were before the thread entered background processing mode.
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.
Windows Server 2003: This value is not supported.
THREAD_PRIORITY_ABOVE_NORMAL1Priority 1 point above the priority class.
THREAD_PRIORITY_BELOW_NORMAL-1Priority 1 point below the priority class.
THREAD_PRIORITY_HIGHEST2Priority 2 points above the priority class.
THREAD_PRIORITY_IDLE-15Base 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.
THREAD_PRIORITY_LOWEST-2Priority 2 points below the priority class.
THREAD_PRIORITY_NORMAL0Normal priority for the priority class.
THREAD_PRIORITY_TIME_CRITICAL15Base 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.

Keywords

FAQs

Package last updated on 16 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc