Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

n-api: add API for asynchronous functions (simpler version) #17887

Commits on Jun 19, 2018

  1. n-api: add API for asynchronous functions

    Bundle a `uv_async_t`, a `uv_idle_t`, a `uv_mutex_t`, a `uv_cond_t`,
    and a `v8::Persistent<v8::Function>` to make it possible to call into JS
    from another thread. The API accepts a void data pointer and a callback
    which will be invoked on the loop thread and which will receive the
    `napi_value` representing the JavaScript function to call so as to
    perform the call into JS. The callback is run inside a
    `node::CallbackScope`.
    
    A `std::queue<void*>` is used to store calls from the secondary
    threads, and an idle loop is started by the `uv_async_t` callback on the
    loop thread to drain the queue, calling into JS with each item.
    
    Items can be added to the queue blockingly or non-blockingly.
    
    The thread-safe function can be referenced or unreferenced, with the
    same semantics as libuv handles.
    
    Re: nodejs/help#1035
    Re: nodejs#20964
    Fixes: nodejs#13512
    Gabriel Schulhof committed Jun 19, 2018
    Configuration menu
    Copy the full SHA
    6a4f191 View commit details
    Browse the repository at this point in the history
  2. remove unused error code from doc

    Gabriel Schulhof committed Jun 19, 2018
    Configuration menu
    Copy the full SHA
    0764640 View commit details
    Browse the repository at this point in the history
  3. add NAPI_EXPERIMENTAL to doc

    Gabriel Schulhof committed Jun 19, 2018
    Configuration menu
    Copy the full SHA
    6d2a7aa View commit details
    Browse the repository at this point in the history
  4. improve reaches-zero-threadcount wording

    Gabriel Schulhof committed Jun 19, 2018
    Configuration menu
    Copy the full SHA
    8710c07 View commit details
    Browse the repository at this point in the history
  5. use proper null-checks

    Gabriel Schulhof committed Jun 19, 2018
    Configuration menu
    Copy the full SHA
    56bded7 View commit details
    Browse the repository at this point in the history
  6. move CloseHandlesAndMaybeDelete() higher

    Gabriel Schulhof committed Jun 19, 2018
    Configuration menu
    Copy the full SHA
    7e72e13 View commit details
    Browse the repository at this point in the history
  7. use proper array length in test

    Gabriel Schulhof committed Jun 19, 2018
    Configuration menu
    Copy the full SHA
    2e058a2 View commit details
    Browse the repository at this point in the history

Commits on Jun 29, 2018

  1. forgot messages for new error statuses

    Gabriel Schulhof committed Jun 29, 2018
    Configuration menu
    Copy the full SHA
    f2da8d2 View commit details
    Browse the repository at this point in the history