MCPcopy Index your code
hub / github.com/nodejs/node / checkPriority

Function checkPriority

test/parallel/test-os-process-priority.js:121–145  ·  view source on GitHub ↗
(pid, expected)

Source from the content-addressed store, hash-verified

119
120
121function checkPriority(pid, expected) {
122 const priority = os.getPriority(pid);
123
124 // Verify that the priority values match on Unix, and are range mapped on
125 // Windows.
126 if (!common.isWindows) {
127 assert.strictEqual(priority, expected);
128 return;
129 }
130
131 // On Windows setting PRIORITY_HIGHEST will only work for elevated user,
132 // for others it will be silently reduced to PRIORITY_HIGH
133 if (expected < PRIORITY_HIGH)
134 assert.ok(priority === PRIORITY_HIGHEST || priority === PRIORITY_HIGH);
135 else if (expected < PRIORITY_ABOVE_NORMAL)
136 assert.strictEqual(priority, PRIORITY_HIGH);
137 else if (expected < PRIORITY_NORMAL)
138 assert.strictEqual(priority, PRIORITY_ABOVE_NORMAL);
139 else if (expected < PRIORITY_BELOW_NORMAL)
140 assert.strictEqual(priority, PRIORITY_NORMAL);
141 else if (expected < PRIORITY_LOW)
142 assert.strictEqual(priority, PRIORITY_BELOW_NORMAL);
143 else
144 assert.strictEqual(priority, PRIORITY_LOW);
145}

Callers 1

Calls 2

getPriorityMethod · 0.80
okMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…