{"action":"created","comment":{"url":"https://api.github.com/repos/libuv/libuv/pulls/comments/139460835","pull_request_review_id":63207878,"id":139460835,"diff_hunk":"@@ -310,3 +332,44 @@ int uv_cancel(uv_req_t* req) {\n \n   return uv__work_cancel(loop, req, wreq);\n }\n+\n+\n+static void report(enum estage stage, int lock) {\n+  QUEUE* q;\n+  uv_queue_stats_t* s;\n+  int length_;\n+  int threads_;\n+\n+  if (lock) uv_mutex_lock(&mutex);\n+\n+  if (!QUEUE_EMPTY(&stats)) {\n+    length_ = wq_length;\n+    threads_ = idle_threads;\n+\n+    QUEUE_FOREACH(q, &stats) {\n+      s = QUEUE_DATA(q, struct uv_queue_stats_s, q);\n+      switch(stage) {\n+        case SUBMIT: s->submit_cb(length_, threads_, s->data); break;\n+        case START: s->start_cb(length_, threads_, s->data); break;\n+        case DONE: s->done_cb(length_, threads_, s->data); break;","path":"src/threadpool.c","position":99,"original_position":99,"commit_id":"571e7b713b6c2da35cca9a36c93b3ab90e8630a2","original_commit_id":"571e7b713b6c2da35cca9a36c93b3ab90e8630a2","user":{"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},"body":"The callbacks shouldn't be made with the lock held, should they?\r\n\r\nStylistic: libuv doesn't use everything-on-one-line style.  (Same goes for the `if` statements.)","created_at":"2017-09-18T15:45:02Z","updated_at":"2017-09-18T15:50:25Z","html_url":"https://github.com/libuv/libuv/pull/1528#discussion_r139460835","pull_request_url":"https://api.github.com/repos/libuv/libuv/pulls/1528","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/libuv/libuv/pulls/comments/139460835"},"html":{"href":"https://github.com/libuv/libuv/pull/1528#discussion_r139460835"},"pull_request":{"href":"https://api.github.com/repos/libuv/libuv/pulls/1528"}}},"pull_request":{"url":"https://api.github.com/repos/libuv/libuv/pulls/1528","id":139663104,"html_url":"https://github.com/libuv/libuv/pull/1528","diff_url":"https://github.com/libuv/libuv/pull/1528.diff","patch_url":"https://github.com/libuv/libuv/pull/1528.patch","issue_url":"https://api.github.com/repos/libuv/libuv/issues/1528","number":1528,"state":"open","locked":false,"title":"Threadpool stats API","user":{"login":"sam-github","id":17607,"avatar_url":"https://avatars2.githubusercontent.com/u/17607?v=4","gravatar_id":"","url":"https://api.github.com/users/sam-github","html_url":"https://github.com/sam-github","followers_url":"https://api.github.com/users/sam-github/followers","following_url":"https://api.github.com/users/sam-github/following{/other_user}","gists_url":"https://api.github.com/users/sam-github/gists{/gist_id}","starred_url":"https://api.github.com/users/sam-github/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sam-github/subscriptions","organizations_url":"https://api.github.com/users/sam-github/orgs","repos_url":"https://api.github.com/users/sam-github/repos","events_url":"https://api.github.com/users/sam-github/events{/privacy}","received_events_url":"https://api.github.com/users/sam-github/received_events","type":"User","site_admin":false},"body":"Fix https://github.com/libuv/libuv/issues/1144\r\n\r\nIn the process of describing which node.js APIs use the threadpool (https://github.com/nodejs/node/pull/14995) I came up against the difficulty of knowing whether the threadpool is out of idle threads, or accumulating work items that can't be processed. The threadpool is private, there was no way to access or observe it, even from C, so this PR introduces APIs to observe the pool.","created_at":"2017-09-06T20:57:23Z","updated_at":"2017-09-18T15:50:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c35b342b171da9bddbc4ae93d79b39cda4940b52","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/libuv/libuv/pulls/1528/commits","review_comments_url":"https://api.github.com/repos/libuv/libuv/pulls/1528/comments","review_comment_url":"https://api.github.com/repos/libuv/libuv/pulls/comments{/number}","comments_url":"https://api.github.com/repos/libuv/libuv/issues/1528/comments","statuses_url":"https://api.github.com/repos/libuv/libuv/statuses/571e7b713b6c2da35cca9a36c93b3ab90e8630a2","head":{"label":"sam-github:threadpool-stats","ref":"threadpool-stats","sha":"571e7b713b6c2da35cca9a36c93b3ab90e8630a2","user":{"login":"sam-github","id":17607,"avatar_url":"https://avatars2.githubusercontent.com/u/17607?v=4","gravatar_id":"","url":"https://api.github.com/users/sam-github","html_url":"https://github.com/sam-github","followers_url":"https://api.github.com/users/sam-github/followers","following_url":"https://api.github.com/users/sam-github/following{/other_user}","gists_url":"https://api.github.com/users/sam-github/gists{/gist_id}","starred_url":"https://api.github.com/users/sam-github/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sam-github/subscriptions","organizations_url":"https://api.github.com/users/sam-github/orgs","repos_url":"https://api.github.com/users/sam-github/repos","events_url":"https://api.github.com/users/sam-github/events{/privacy}","received_events_url":"https://api.github.com/users/sam-github/received_events","type":"User","site_admin":false},"repo":{"id":31282826,"name":"libuv","full_name":"sam-github/libuv","owner":{"login":"sam-github","id":17607,"avatar_url":"https://avatars2.githubusercontent.com/u/17607?v=4","gravatar_id":"","url":"https://api.github.com/users/sam-github","html_url":"https://github.com/sam-github","followers_url":"https://api.github.com/users/sam-github/followers","following_url":"https://api.github.com/users/sam-github/following{/other_user}","gists_url":"https://api.github.com/users/sam-github/gists{/gist_id}","starred_url":"https://api.github.com/users/sam-github/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sam-github/subscriptions","organizations_url":"https://api.github.com/users/sam-github/orgs","repos_url":"https://api.github.com/users/sam-github/repos","events_url":"https://api.github.com/users/sam-github/events{/privacy}","received_events_url":"https://api.github.com/users/sam-github/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sam-github/libuv","description":"Cross-platform asychronous I/O","fork":true,"url":"https://api.github.com/repos/sam-github/libuv","forks_url":"https://api.github.com/repos/sam-github/libuv/forks","keys_url":"https://api.github.com/repos/sam-github/libuv/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sam-github/libuv/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sam-github/libuv/teams","hooks_url":"https://api.github.com/repos/sam-github/libuv/hooks","issue_events_url":"https://api.github.com/repos/sam-github/libuv/issues/events{/number}","events_url":"https://api.github.com/repos/sam-github/libuv/events","assignees_url":"https://api.github.com/repos/sam-github/libuv/assignees{/user}","branches_url":"https://api.github.com/repos/sam-github/libuv/branches{/branch}","tags_url":"https://api.github.com/repos/sam-github/libuv/tags","blobs_url":"https://api.github.com/repos/sam-github/libuv/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sam-github/libuv/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sam-github/libuv/git/refs{/sha}","trees_url":"https://api.github.com/repos/sam-github/libuv/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sam-github/libuv/statuses/{sha}","languages_url":"https://api.github.com/repos/sam-github/libuv/languages","stargazers_url":"https://api.github.com/repos/sam-github/libuv/stargazers","contributors_url":"https://api.github.com/repos/sam-github/libuv/contributors","subscribers_url":"https://api.github.com/repos/sam-github/libuv/subscribers","subscription_url":"https://api.github.com/repos/sam-github/libuv/subscription","commits_url":"https://api.github.com/repos/sam-github/libuv/commits{/sha}","git_commits_url":"https://api.github.com/repos/sam-github/libuv/git/commits{/sha}","comments_url":"https://api.github.com/repos/sam-github/libuv/comments{/number}","issue_comment_url":"https://api.github.com/repos/sam-github/libuv/issues/comments{/number}","contents_url":"https://api.github.com/repos/sam-github/libuv/contents/{+path}","compare_url":"https://api.github.com/repos/sam-github/libuv/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sam-github/libuv/merges","archive_url":"https://api.github.com/repos/sam-github/libuv/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sam-github/libuv/downloads","issues_url":"https://api.github.com/repos/sam-github/libuv/issues{/number}","pulls_url":"https://api.github.com/repos/sam-github/libuv/pulls{/number}","milestones_url":"https://api.github.com/repos/sam-github/libuv/milestones{/number}","notifications_url":"https://api.github.com/repos/sam-github/libuv/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sam-github/libuv/labels{/name}","releases_url":"https://api.github.com/repos/sam-github/libuv/releases{/id}","deployments_url":"https://api.github.com/repos/sam-github/libuv/deployments","created_at":"2015-02-24T21:25:56Z","updated_at":"2016-11-23T15:04:46Z","pushed_at":"2017-09-06T20:44:55Z","git_url":"git://github.com/sam-github/libuv.git","ssh_url":"git@github.com:sam-github/libuv.git","clone_url":"https://github.com/sam-github/libuv.git","svn_url":"https://github.com/sam-github/libuv","homepage":"http://libuv.org/","size":11808,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"v1.x"}},"base":{"label":"libuv:v1.x","ref":"v1.x","sha":"1a682cb7c0be43cdc0bd7cce4f4514e723c69bb8","user":{"login":"libuv","id":4030929,"avatar_url":"https://avatars1.githubusercontent.com/u/4030929?v=4","gravatar_id":"","url":"https://api.github.com/users/libuv","html_url":"https://github.com/libuv","followers_url":"https://api.github.com/users/libuv/followers","following_url":"https://api.github.com/users/libuv/following{/other_user}","gists_url":"https://api.github.com/users/libuv/gists{/gist_id}","starred_url":"https://api.github.com/users/libuv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libuv/subscriptions","organizations_url":"https://api.github.com/users/libuv/orgs","repos_url":"https://api.github.com/users/libuv/repos","events_url":"https://api.github.com/users/libuv/events{/privacy}","received_events_url":"https://api.github.com/users/libuv/received_events","type":"Organization","site_admin":false},"repo":{"id":14812739,"name":"libuv","full_name":"libuv/libuv","owner":{"login":"libuv","id":4030929,"avatar_url":"https://avatars1.githubusercontent.com/u/4030929?v=4","gravatar_id":"","url":"https://api.github.com/users/libuv","html_url":"https://github.com/libuv","followers_url":"https://api.github.com/users/libuv/followers","following_url":"https://api.github.com/users/libuv/following{/other_user}","gists_url":"https://api.github.com/users/libuv/gists{/gist_id}","starred_url":"https://api.github.com/users/libuv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libuv/subscriptions","organizations_url":"https://api.github.com/users/libuv/orgs","repos_url":"https://api.github.com/users/libuv/repos","events_url":"https://api.github.com/users/libuv/events{/privacy}","received_events_url":"https://api.github.com/users/libuv/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/libuv/libuv","description":"Cross-platform asynchronous I/O","fork":false,"url":"https://api.github.com/repos/libuv/libuv","forks_url":"https://api.github.com/repos/libuv/libuv/forks","keys_url":"https://api.github.com/repos/libuv/libuv/keys{/key_id}","collaborators_url":"https://api.github.com/repos/libuv/libuv/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/libuv/libuv/teams","hooks_url":"https://api.github.com/repos/libuv/libuv/hooks","issue_events_url":"https://api.github.com/repos/libuv/libuv/issues/events{/number}","events_url":"https://api.github.com/repos/libuv/libuv/events","assignees_url":"https://api.github.com/repos/libuv/libuv/assignees{/user}","branches_url":"https://api.github.com/repos/libuv/libuv/branches{/branch}","tags_url":"https://api.github.com/repos/libuv/libuv/tags","blobs_url":"https://api.github.com/repos/libuv/libuv/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/libuv/libuv/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/libuv/libuv/git/refs{/sha}","trees_url":"https://api.github.com/repos/libuv/libuv/git/trees{/sha}","statuses_url":"https://api.github.com/repos/libuv/libuv/statuses/{sha}","languages_url":"https://api.github.com/repos/libuv/libuv/languages","stargazers_url":"https://api.github.com/repos/libuv/libuv/stargazers","contributors_url":"https://api.github.com/repos/libuv/libuv/contributors","subscribers_url":"https://api.github.com/repos/libuv/libuv/subscribers","subscription_url":"https://api.github.com/repos/libuv/libuv/subscription","commits_url":"https://api.github.com/repos/libuv/libuv/commits{/sha}","git_commits_url":"https://api.github.com/repos/libuv/libuv/git/commits{/sha}","comments_url":"https://api.github.com/repos/libuv/libuv/comments{/number}","issue_comment_url":"https://api.github.com/repos/libuv/libuv/issues/comments{/number}","contents_url":"https://api.github.com/repos/libuv/libuv/contents/{+path}","compare_url":"https://api.github.com/repos/libuv/libuv/compare/{base}...{head}","merges_url":"https://api.github.com/repos/libuv/libuv/merges","archive_url":"https://api.github.com/repos/libuv/libuv/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/libuv/libuv/downloads","issues_url":"https://api.github.com/repos/libuv/libuv/issues{/number}","pulls_url":"https://api.github.com/repos/libuv/libuv/pulls{/number}","milestones_url":"https://api.github.com/repos/libuv/libuv/milestones{/number}","notifications_url":"https://api.github.com/repos/libuv/libuv/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/libuv/libuv/labels{/name}","releases_url":"https://api.github.com/repos/libuv/libuv/releases{/id}","deployments_url":"https://api.github.com/repos/libuv/libuv/deployments","created_at":"2013-11-30T00:29:56Z","updated_at":"2017-09-18T14:21:15Z","pushed_at":"2017-09-18T15:42:45Z","git_url":"git://github.com/libuv/libuv.git","ssh_url":"git@github.com:libuv/libuv.git","clone_url":"https://github.com/libuv/libuv.git","svn_url":"https://github.com/libuv/libuv","homepage":"http://libuv.org/","size":12112,"stargazers_count":7405,"watchers_count":7405,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1244,"mirror_url":null,"open_issues_count":170,"forks":1244,"open_issues":170,"watchers":7405,"default_branch":"v1.x"}},"_links":{"self":{"href":"https://api.github.com/repos/libuv/libuv/pulls/1528"},"html":{"href":"https://github.com/libuv/libuv/pull/1528"},"issue":{"href":"https://api.github.com/repos/libuv/libuv/issues/1528"},"comments":{"href":"https://api.github.com/repos/libuv/libuv/issues/1528/comments"},"review_comments":{"href":"https://api.github.com/repos/libuv/libuv/pulls/1528/comments"},"review_comment":{"href":"https://api.github.com/repos/libuv/libuv/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/libuv/libuv/pulls/1528/commits"},"statuses":{"href":"https://api.github.com/repos/libuv/libuv/statuses/571e7b713b6c2da35cca9a36c93b3ab90e8630a2"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"bnoordhuis"}}