{"action":"created","comment":{"url":"https://api.github.com/repos/nodejs/node/pulls/comments/190734756","pull_request_review_id":123176295,"id":190734756,"diff_hunk":"@@ -3835,6 +3881,201 @@ NAPI_EXTERN napi_status napi_get_uv_event_loop(napi_env env,\n - `[in] env`: The environment that the API is invoked under.\n - `[out] loop`: The current libuv loop instance.\n \n+<!-- it's very convenient to have all the anchors indexed -->\n+<!--lint disable no-unused-definitions remark-lint-->\n+## Asynchronous Thread-safe Function Calls\n+\n+JavaScript functions can normally only be called from a native addon's main\n+thread. If an addon creates additional threads, then N-API functions that\n+require a `napi_env`, `napi_value`, or `napi_ref` must not be called from those\n+threads.\n+\n+This API provides the type `napi_threadsafe_function` as well as APIs to create,\n+destroy, and call objects of this type. `napi_create_threadsafe_function()`\n+creates a permanent reference to a `napi_value` that holds a JavaScript\n+function, and uses `uv_async_t`, `uv_mutex_t`, `u_cond_t`, and `uv_idle_t` from","path":"doc/api/n-api.md","position":83,"original_position":83,"commit_id":"4b3b2c83ab1d50a80c7952f275fba106e62d0957","original_commit_id":"4b3b2c83ab1d50a80c7952f275fba106e62d0957","user":{"login":"mhdawson","id":9373002,"avatar_url":"https://avatars3.githubusercontent.com/u/9373002?v=4","gravatar_id":"","url":"https://api.github.com/users/mhdawson","html_url":"https://github.com/mhdawson","followers_url":"https://api.github.com/users/mhdawson/followers","following_url":"https://api.github.com/users/mhdawson/following{/other_user}","gists_url":"https://api.github.com/users/mhdawson/gists{/gist_id}","starred_url":"https://api.github.com/users/mhdawson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhdawson/subscriptions","organizations_url":"https://api.github.com/users/mhdawson/orgs","repos_url":"https://api.github.com/users/mhdawson/repos","events_url":"https://api.github.com/users/mhdawson/events{/privacy}","received_events_url":"https://api.github.com/users/mhdawson/received_events","type":"User","site_admin":false},"body":"permanent?  Maybe persistent, as I assume it is not permanent in the sense of never going away.","created_at":"2018-05-24T21:21:47Z","updated_at":"2018-05-24T21:36:23Z","html_url":"https://github.com/nodejs/node/pull/17887#discussion_r190734756","pull_request_url":"https://api.github.com/repos/nodejs/node/pulls/17887","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments/190734756"},"html":{"href":"https://github.com/nodejs/node/pull/17887#discussion_r190734756"},"pull_request":{"href":"https://api.github.com/repos/nodejs/node/pulls/17887"}}},"pull_request":{"url":"https://api.github.com/repos/nodejs/node/pulls/17887","id":160305250,"html_url":"https://github.com/nodejs/node/pull/17887","diff_url":"https://github.com/nodejs/node/pull/17887.diff","patch_url":"https://github.com/nodejs/node/pull/17887.patch","issue_url":"https://api.github.com/repos/nodejs/node/issues/17887","number":17887,"state":"open","locked":false,"title":"n-api: add API for asynchronous functions (simpler version)","user":{"login":"gabrielschulhof","id":976081,"avatar_url":"https://avatars2.githubusercontent.com/u/976081?v=4","gravatar_id":"","url":"https://api.github.com/users/gabrielschulhof","html_url":"https://github.com/gabrielschulhof","followers_url":"https://api.github.com/users/gabrielschulhof/followers","following_url":"https://api.github.com/users/gabrielschulhof/following{/other_user}","gists_url":"https://api.github.com/users/gabrielschulhof/gists{/gist_id}","starred_url":"https://api.github.com/users/gabrielschulhof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabrielschulhof/subscriptions","organizations_url":"https://api.github.com/users/gabrielschulhof/orgs","repos_url":"https://api.github.com/users/gabrielschulhof/repos","events_url":"https://api.github.com/users/gabrielschulhof/events{/privacy}","received_events_url":"https://api.github.com/users/gabrielschulhof/received_events","type":"User","site_admin":false},"body":"Bundle a `uv_async_t` and a `napi_ref` to make it possible to call into\r\nJS from another thread. The API accepts a void data pointer and a\r\ncallback which will be invoked on the loop thread and which will\r\nreceive the `napi_value` resulting from the `napi_ref` so as to perform\r\nthe call into JS. The callback is run inside a `node::CallbackScope`.\r\n\r\nFixes: https://github.com/nodejs/node/issues/13512\r\n\r\n<!--\r\nThank you for your pull request. Please provide a description above and review\r\nthe requirements below.\r\n\r\nBug fixes and new features should include tests and possibly benchmarks.\r\n\r\nContributors guide: https://github.com/nodejs/node/blob/master/CONTRIBUTING.md\r\n-->\r\n\r\n##### Checklist\r\n<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->\r\n\r\n- [x] `make -j4 test` (UNIX), or `vcbuild test` (Windows) passes\r\n- [x] tests and/or benchmarks are included\r\n- [x] documentation is changed or added\r\n- [x] commit message follows [commit guidelines](https://github.com/nodejs/node/blob/master/CONTRIBUTING.md#commit-message-guidelines)\r\n\r\n##### Affected core subsystem(s)\r\n<!-- Provide affected core subsystem(s) (like doc, cluster, crypto, etc). -->\r\nn-api\r\n\r\nThis is an alternative, and perhaps simpler implementation of `napi_threadsafe_function`, alternative to https://github.com/nodejs/node/pull/17809/","created_at":"2017-12-27T21:32:30Z","updated_at":"2018-05-24T21:36:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"89fd996a1724bc01fb6a661b10b1406cf444e997","assignee":null,"assignees":[],"requested_reviewers":[{"login":"bnoordhuis","id":275871,"avatar_url":"https://avatars0.githubusercontent.com/u/275871?v=4","gravatar_id":"","url":"https://api.github.com/users/bnoordhuis","html_url":"https://github.com/bnoordhuis","followers_url":"https://api.github.com/users/bnoordhuis/followers","following_url":"https://api.github.com/users/bnoordhuis/following{/other_user}","gists_url":"https://api.github.com/users/bnoordhuis/gists{/gist_id}","starred_url":"https://api.github.com/users/bnoordhuis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bnoordhuis/subscriptions","organizations_url":"https://api.github.com/users/bnoordhuis/orgs","repos_url":"https://api.github.com/users/bnoordhuis/repos","events_url":"https://api.github.com/users/bnoordhuis/events{/privacy}","received_events_url":"https://api.github.com/users/bnoordhuis/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":155267502,"url":"https://api.github.com/repos/nodejs/node/labels/C++","name":"C++","color":"e11d21","default":false},{"id":281232761,"url":"https://api.github.com/repos/nodejs/node/labels/lib%20/%20src","name":"lib / src","color":"fad8c7","default":false},{"id":574036893,"url":"https://api.github.com/repos/nodejs/node/labels/n-api","name":"n-api","color":"d93f0b","default":false},{"id":169485478,"url":"https://api.github.com/repos/nodejs/node/labels/semver-minor","name":"semver-minor","color":"fef2c0","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/nodejs/node/pulls/17887/commits","review_comments_url":"https://api.github.com/repos/nodejs/node/pulls/17887/comments","review_comment_url":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nodejs/node/issues/17887/comments","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/4b3b2c83ab1d50a80c7952f275fba106e62d0957","head":{"label":"gabrielschulhof:napi-threadsafe-function-call-js","ref":"napi-threadsafe-function-call-js","sha":"4b3b2c83ab1d50a80c7952f275fba106e62d0957","user":{"login":"gabrielschulhof","id":976081,"avatar_url":"https://avatars2.githubusercontent.com/u/976081?v=4","gravatar_id":"","url":"https://api.github.com/users/gabrielschulhof","html_url":"https://github.com/gabrielschulhof","followers_url":"https://api.github.com/users/gabrielschulhof/followers","following_url":"https://api.github.com/users/gabrielschulhof/following{/other_user}","gists_url":"https://api.github.com/users/gabrielschulhof/gists{/gist_id}","starred_url":"https://api.github.com/users/gabrielschulhof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabrielschulhof/subscriptions","organizations_url":"https://api.github.com/users/gabrielschulhof/orgs","repos_url":"https://api.github.com/users/gabrielschulhof/repos","events_url":"https://api.github.com/users/gabrielschulhof/events{/privacy}","received_events_url":"https://api.github.com/users/gabrielschulhof/received_events","type":"User","site_admin":false},"repo":{"id":87114255,"name":"node","full_name":"gabrielschulhof/node","owner":{"login":"gabrielschulhof","id":976081,"avatar_url":"https://avatars2.githubusercontent.com/u/976081?v=4","gravatar_id":"","url":"https://api.github.com/users/gabrielschulhof","html_url":"https://github.com/gabrielschulhof","followers_url":"https://api.github.com/users/gabrielschulhof/followers","following_url":"https://api.github.com/users/gabrielschulhof/following{/other_user}","gists_url":"https://api.github.com/users/gabrielschulhof/gists{/gist_id}","starred_url":"https://api.github.com/users/gabrielschulhof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabrielschulhof/subscriptions","organizations_url":"https://api.github.com/users/gabrielschulhof/orgs","repos_url":"https://api.github.com/users/gabrielschulhof/repos","events_url":"https://api.github.com/users/gabrielschulhof/events{/privacy}","received_events_url":"https://api.github.com/users/gabrielschulhof/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gabrielschulhof/node","description":"Node.js JavaScript runtime :sparkles::turtle::rocket::sparkles:","fork":true,"url":"https://api.github.com/repos/gabrielschulhof/node","forks_url":"https://api.github.com/repos/gabrielschulhof/node/forks","keys_url":"https://api.github.com/repos/gabrielschulhof/node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gabrielschulhof/node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gabrielschulhof/node/teams","hooks_url":"https://api.github.com/repos/gabrielschulhof/node/hooks","issue_events_url":"https://api.github.com/repos/gabrielschulhof/node/issues/events{/number}","events_url":"https://api.github.com/repos/gabrielschulhof/node/events","assignees_url":"https://api.github.com/repos/gabrielschulhof/node/assignees{/user}","branches_url":"https://api.github.com/repos/gabrielschulhof/node/branches{/branch}","tags_url":"https://api.github.com/repos/gabrielschulhof/node/tags","blobs_url":"https://api.github.com/repos/gabrielschulhof/node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gabrielschulhof/node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gabrielschulhof/node/git/refs{/sha}","trees_url":"https://api.github.com/repos/gabrielschulhof/node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gabrielschulhof/node/statuses/{sha}","languages_url":"https://api.github.com/repos/gabrielschulhof/node/languages","stargazers_url":"https://api.github.com/repos/gabrielschulhof/node/stargazers","contributors_url":"https://api.github.com/repos/gabrielschulhof/node/contributors","subscribers_url":"https://api.github.com/repos/gabrielschulhof/node/subscribers","subscription_url":"https://api.github.com/repos/gabrielschulhof/node/subscription","commits_url":"https://api.github.com/repos/gabrielschulhof/node/commits{/sha}","git_commits_url":"https://api.github.com/repos/gabrielschulhof/node/git/commits{/sha}","comments_url":"https://api.github.com/repos/gabrielschulhof/node/comments{/number}","issue_comment_url":"https://api.github.com/repos/gabrielschulhof/node/issues/comments{/number}","contents_url":"https://api.github.com/repos/gabrielschulhof/node/contents/{+path}","compare_url":"https://api.github.com/repos/gabrielschulhof/node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gabrielschulhof/node/merges","archive_url":"https://api.github.com/repos/gabrielschulhof/node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gabrielschulhof/node/downloads","issues_url":"https://api.github.com/repos/gabrielschulhof/node/issues{/number}","pulls_url":"https://api.github.com/repos/gabrielschulhof/node/pulls{/number}","milestones_url":"https://api.github.com/repos/gabrielschulhof/node/milestones{/number}","notifications_url":"https://api.github.com/repos/gabrielschulhof/node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gabrielschulhof/node/labels{/name}","releases_url":"https://api.github.com/repos/gabrielschulhof/node/releases{/id}","deployments_url":"https://api.github.com/repos/gabrielschulhof/node/deployments","created_at":"2017-04-03T19:46:33Z","updated_at":"2018-05-24T21:06:02Z","pushed_at":"2018-05-24T21:05:51Z","git_url":"git://github.com/gabrielschulhof/node.git","ssh_url":"git@github.com:gabrielschulhof/node.git","clone_url":"https://github.com/gabrielschulhof/node.git","svn_url":"https://github.com/gabrielschulhof/node","homepage":"https://nodejs.org","size":370850,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"nodejs:master","ref":"master","sha":"6caecc614a73ffce78fcac0d74e2038cfd05d16a","user":{"login":"nodejs","id":9950313,"avatar_url":"https://avatars3.githubusercontent.com/u/9950313?v=4","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"repo":{"id":27193779,"name":"node","full_name":"nodejs/node","owner":{"login":"nodejs","id":9950313,"avatar_url":"https://avatars3.githubusercontent.com/u/9950313?v=4","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nodejs/node","description":"Node.js JavaScript runtime :sparkles::turtle::rocket::sparkles:","fork":false,"url":"https://api.github.com/repos/nodejs/node","forks_url":"https://api.github.com/repos/nodejs/node/forks","keys_url":"https://api.github.com/repos/nodejs/node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nodejs/node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nodejs/node/teams","hooks_url":"https://api.github.com/repos/nodejs/node/hooks","issue_events_url":"https://api.github.com/repos/nodejs/node/issues/events{/number}","events_url":"https://api.github.com/repos/nodejs/node/events","assignees_url":"https://api.github.com/repos/nodejs/node/assignees{/user}","branches_url":"https://api.github.com/repos/nodejs/node/branches{/branch}","tags_url":"https://api.github.com/repos/nodejs/node/tags","blobs_url":"https://api.github.com/repos/nodejs/node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nodejs/node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nodejs/node/git/refs{/sha}","trees_url":"https://api.github.com/repos/nodejs/node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/{sha}","languages_url":"https://api.github.com/repos/nodejs/node/languages","stargazers_url":"https://api.github.com/repos/nodejs/node/stargazers","contributors_url":"https://api.github.com/repos/nodejs/node/contributors","subscribers_url":"https://api.github.com/repos/nodejs/node/subscribers","subscription_url":"https://api.github.com/repos/nodejs/node/subscription","commits_url":"https://api.github.com/repos/nodejs/node/commits{/sha}","git_commits_url":"https://api.github.com/repos/nodejs/node/git/commits{/sha}","comments_url":"https://api.github.com/repos/nodejs/node/comments{/number}","issue_comment_url":"https://api.github.com/repos/nodejs/node/issues/comments{/number}","contents_url":"https://api.github.com/repos/nodejs/node/contents/{+path}","compare_url":"https://api.github.com/repos/nodejs/node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nodejs/node/merges","archive_url":"https://api.github.com/repos/nodejs/node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nodejs/node/downloads","issues_url":"https://api.github.com/repos/nodejs/node/issues{/number}","pulls_url":"https://api.github.com/repos/nodejs/node/pulls{/number}","milestones_url":"https://api.github.com/repos/nodejs/node/milestones{/number}","notifications_url":"https://api.github.com/repos/nodejs/node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nodejs/node/labels{/name}","releases_url":"https://api.github.com/repos/nodejs/node/releases{/id}","deployments_url":"https://api.github.com/repos/nodejs/node/deployments","created_at":"2014-11-26T19:57:11Z","updated_at":"2018-05-24T20:10:38Z","pushed_at":"2018-05-24T21:22:17Z","git_url":"git://github.com/nodejs/node.git","ssh_url":"git@github.com:nodejs/node.git","clone_url":"https://github.com/nodejs/node.git","svn_url":"https://github.com/nodejs/node","homepage":"https://nodejs.org","size":378475,"stargazers_count":49177,"watchers_count":49177,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":10372,"mirror_url":null,"archived":false,"open_issues_count":753,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":10372,"open_issues":753,"watchers":49177,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/17887"},"html":{"href":"https://github.com/nodejs/node/pull/17887"},"issue":{"href":"https://api.github.com/repos/nodejs/node/issues/17887"},"comments":{"href":"https://api.github.com/repos/nodejs/node/issues/17887/comments"},"review_comments":{"href":"https://api.github.com/repos/nodejs/node/pulls/17887/comments"},"review_comment":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nodejs/node/pulls/17887/commits"},"statuses":{"href":"https://api.github.com/repos/nodejs/node/statuses/4b3b2c83ab1d50a80c7952f275fba106e62d0957"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"mhdawson"}}