Skip to content

uv, os: implement os.{get,set}Priority functions#409

Merged
yorkie merged 1 commit intomasterfrom
uv/core
Dec 3, 2018
Merged

uv, os: implement os.{get,set}Priority functions#409
yorkie merged 1 commit intomasterfrom
uv/core

Conversation

@yorkie
Copy link
Copy Markdown
Member

@yorkie yorkie commented Nov 8, 2018

This implements the following APIs:

With the group of APIs, we are able to tweak the priority level on demand at runtime.

Checklist
  • npm test passes
  • tests and/or benchmarks are included
  • documentation is changed or added

@yorkie yorkie added the uv label Nov 8, 2018
@yorkie yorkie requested review from algebrait and qile222 November 8, 2018 17:13
@yorkie yorkie added the minor minor changes label Nov 8, 2018
@yorkie yorkie requested a review from legendecas November 9, 2018 05:00
src/js/os.js Outdated
if (typeof priority !== 'number') {
throw new TypeError('priority must be a number');
}
if (priority > 19) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use UV_PRIORITY_LOW and UV_PRIORITY_HIGHST defined from UV instead of literal ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually those defines are for using at Windows, I still leave those on uv.h is to acquire consistence.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems those defines are using at Linux too, see setPriority doc

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please reference the code/lines in details? Can not search any that defines from your link :(

@yorkie yorkie force-pushed the uv/core branch 2 times, most recently from 234f5fd to c9bebab Compare December 3, 2018 05:34
@yorkie
Copy link
Copy Markdown
Member Author

yorkie commented Dec 3, 2018

The CI seems green now, @lolBig @legendecas please see again :)

src/js/os.js Outdated
if (priority > 19) {
priority = 19;
} else if (priority < -20) {
priority = -20;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should an error been thrown instead of silently rounded?

@yorkie yorkie force-pushed the uv/core branch 3 times, most recently from 3691731 to ec663da Compare December 3, 2018 11:32
src/js/os.js Outdated
if (priority > constants.UV_PRIORITY_LOW ||
priority < constants.UV_PRIORITY_HIGHEST) {
throw new RangeError(
'The value of "priority" is out of range. It must be > -20 && < 19.');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use constants instead of -20 or 19

@yorkie yorkie merged commit 0a60801 into master Dec 3, 2018
@yorkie yorkie deleted the uv/core branch December 3, 2018 13:11
qile222 pushed a commit that referenced this pull request Dec 13, 2018
* master: (35 commits)
  https: client request doesn’t define default encoding (#440)
  n-api: data pointer was NULL on getting typed array info (#441)
  os: build bcast address interface. (#439)
  assert: better deepStrictEqual assertion (#435)
  working on v0.11.x (#434)
  process: memory leaks on recursive ticking (#433)
  uv, os: implement os.{get,set}Priority functions (#409)
  jerry: implement ES2015 class feature (part II.) (#428)
  test: fix wrong travis diff target introduced by #425 (#429)
  jerry: pass and enable jerry-test-suite (#425)
  n-api: ArrayBuffer/TypedArray support (#419)
  deps: upgrade the mbedtls to 2.13.0-apache (#384)
  jerry: rework jerry_parse function (#422)
  jerry: finalize hint of array buffers (#421)
  jerry: reduce the argument count of ecma_op_object_get_property_names (#424)
  n-api: update headers/test suites to LTS(10.13.0) (#416)
  jerry: Date.now shall return an integer (#418)
  n-api: thread safe functions (#411)
  util: IOTJS_ASSERT prints stack trace on macOS (#415)
  process: set immediate shall start an idle handle to activate uv_loop (#417)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor minor changes uv

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants