{"action":"created","comment":{"url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/pulls/comments/222118173","pull_request_review_id":160931086,"id":222118173,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMjExODE3Mw==","diff_hunk":"@@ -0,0 +1,131 @@\n+use std::fmt;\n+use std::process;\n+use std::sync::Arc;\n+\n+use parking_lot::{Condvar, Mutex};\n+\n+/// Enables multiple threads to synchronize the beginning or end of some computation.","path":"src/sync/wait_group.rs","position":7,"original_position":7,"commit_id":"f12cdc1b3f2f498e1f5953f652c58acd17cb6ffe","original_commit_id":"e011a0cd41456528b9b592bbfc3a8f92b3633654","user":{"login":"stjepang","id":1303843,"node_id":"MDQ6VXNlcjEzMDM4NDM=","avatar_url":"https://avatars2.githubusercontent.com/u/1303843?v=4","gravatar_id":"","url":"https://api.github.com/users/stjepang","html_url":"https://github.com/stjepang","followers_url":"https://api.github.com/users/stjepang/followers","following_url":"https://api.github.com/users/stjepang/following{/other_user}","gists_url":"https://api.github.com/users/stjepang/gists{/gist_id}","starred_url":"https://api.github.com/users/stjepang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stjepang/subscriptions","organizations_url":"https://api.github.com/users/stjepang/orgs","repos_url":"https://api.github.com/users/stjepang/repos","events_url":"https://api.github.com/users/stjepang/events{/privacy}","received_events_url":"https://api.github.com/users/stjepang/received_events","type":"User","site_admin":false},"body":"Done.","created_at":"2018-10-02T21:27:28Z","updated_at":"2018-10-02T21:27:28Z","html_url":"https://github.com/crossbeam-rs/crossbeam-utils/pull/50#discussion_r222118173","pull_request_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/pulls/50","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/pulls/comments/222118173"},"html":{"href":"https://github.com/crossbeam-rs/crossbeam-utils/pull/50#discussion_r222118173"},"pull_request":{"href":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/pulls/50"}},"in_reply_to_id":221991867},"pull_request":{"url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/pulls/50","id":219683863,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE5NjgzODYz","html_url":"https://github.com/crossbeam-rs/crossbeam-utils/pull/50","diff_url":"https://github.com/crossbeam-rs/crossbeam-utils/pull/50.diff","patch_url":"https://github.com/crossbeam-rs/crossbeam-utils/pull/50.patch","issue_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/issues/50","number":50,"state":"open","locked":false,"title":"Add WaitGroup synchronization primitive","user":{"login":"stjepang","id":1303843,"node_id":"MDQ6VXNlcjEzMDM4NDM=","avatar_url":"https://avatars2.githubusercontent.com/u/1303843?v=4","gravatar_id":"","url":"https://api.github.com/users/stjepang","html_url":"https://github.com/stjepang","followers_url":"https://api.github.com/users/stjepang/followers","following_url":"https://api.github.com/users/stjepang/following{/other_user}","gists_url":"https://api.github.com/users/stjepang/gists{/gist_id}","starred_url":"https://api.github.com/users/stjepang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stjepang/subscriptions","organizations_url":"https://api.github.com/users/stjepang/orgs","repos_url":"https://api.github.com/users/stjepang/repos","events_url":"https://api.github.com/users/stjepang/events{/privacy}","received_events_url":"https://api.github.com/users/stjepang/received_events","type":"User","site_admin":false},"body":"This is a simple synchronization primitive inspired by Go's [`WaitGroup`](https://golang.org/pkg/sync/#WaitGroup).\r\n\r\nSeveral other crates have already implemented it: [`chan`](https://docs.rs/chan/0.1.23/chan/struct.WaitGroup.html), [`waitout`](https://docs.rs/waitout/0.1.1/waitout/struct.WaitGroup.html), [`wait_group`](https://docs.rs/wait_group/0.1.4/wait_group/struct.WaitGroup.html), and [`scoped-pool`](https://docs.rs/scoped-pool/1.0.0/scoped_pool/struct.WaitGroup.html). This implementation in this PR is simpler and less error prone. More specifically:\r\n\r\n* Instead of calling `.add(n)`, we just create `n` clones of the `WaitGroup`.\r\n* Instead of calling `.done()`, we just drop the `WaitGroup`.\r\n* Calling `.wait()` drops the reference to the `WaitGroup` *and* waits until all other references are dropped.\r\n\r\n`WaitGroup` might be handy in #47.","created_at":"2018-10-02T12:22:55Z","updated_at":"2018-10-02T21:27:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"af1a4cef66c1c1e3cb24ad0fb23b37a39637888e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/pulls/50/commits","review_comments_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/pulls/50/comments","review_comment_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/pulls/comments{/number}","comments_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/issues/50/comments","statuses_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/statuses/f12cdc1b3f2f498e1f5953f652c58acd17cb6ffe","head":{"label":"stjepang:wait-group","ref":"wait-group","sha":"f12cdc1b3f2f498e1f5953f652c58acd17cb6ffe","user":{"login":"stjepang","id":1303843,"node_id":"MDQ6VXNlcjEzMDM4NDM=","avatar_url":"https://avatars2.githubusercontent.com/u/1303843?v=4","gravatar_id":"","url":"https://api.github.com/users/stjepang","html_url":"https://github.com/stjepang","followers_url":"https://api.github.com/users/stjepang/followers","following_url":"https://api.github.com/users/stjepang/following{/other_user}","gists_url":"https://api.github.com/users/stjepang/gists{/gist_id}","starred_url":"https://api.github.com/users/stjepang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stjepang/subscriptions","organizations_url":"https://api.github.com/users/stjepang/orgs","repos_url":"https://api.github.com/users/stjepang/repos","events_url":"https://api.github.com/users/stjepang/events{/privacy}","received_events_url":"https://api.github.com/users/stjepang/received_events","type":"User","site_admin":false},"repo":{"id":104484002,"node_id":"MDEwOlJlcG9zaXRvcnkxMDQ0ODQwMDI=","name":"crossbeam-utils","full_name":"stjepang/crossbeam-utils","private":false,"owner":{"login":"stjepang","id":1303843,"node_id":"MDQ6VXNlcjEzMDM4NDM=","avatar_url":"https://avatars2.githubusercontent.com/u/1303843?v=4","gravatar_id":"","url":"https://api.github.com/users/stjepang","html_url":"https://github.com/stjepang","followers_url":"https://api.github.com/users/stjepang/followers","following_url":"https://api.github.com/users/stjepang/following{/other_user}","gists_url":"https://api.github.com/users/stjepang/gists{/gist_id}","starred_url":"https://api.github.com/users/stjepang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stjepang/subscriptions","organizations_url":"https://api.github.com/users/stjepang/orgs","repos_url":"https://api.github.com/users/stjepang/repos","events_url":"https://api.github.com/users/stjepang/events{/privacy}","received_events_url":"https://api.github.com/users/stjepang/received_events","type":"User","site_admin":false},"html_url":"https://github.com/stjepang/crossbeam-utils","description":"Utilities for concurrent programming","fork":true,"url":"https://api.github.com/repos/stjepang/crossbeam-utils","forks_url":"https://api.github.com/repos/stjepang/crossbeam-utils/forks","keys_url":"https://api.github.com/repos/stjepang/crossbeam-utils/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stjepang/crossbeam-utils/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stjepang/crossbeam-utils/teams","hooks_url":"https://api.github.com/repos/stjepang/crossbeam-utils/hooks","issue_events_url":"https://api.github.com/repos/stjepang/crossbeam-utils/issues/events{/number}","events_url":"https://api.github.com/repos/stjepang/crossbeam-utils/events","assignees_url":"https://api.github.com/repos/stjepang/crossbeam-utils/assignees{/user}","branches_url":"https://api.github.com/repos/stjepang/crossbeam-utils/branches{/branch}","tags_url":"https://api.github.com/repos/stjepang/crossbeam-utils/tags","blobs_url":"https://api.github.com/repos/stjepang/crossbeam-utils/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stjepang/crossbeam-utils/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stjepang/crossbeam-utils/git/refs{/sha}","trees_url":"https://api.github.com/repos/stjepang/crossbeam-utils/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stjepang/crossbeam-utils/statuses/{sha}","languages_url":"https://api.github.com/repos/stjepang/crossbeam-utils/languages","stargazers_url":"https://api.github.com/repos/stjepang/crossbeam-utils/stargazers","contributors_url":"https://api.github.com/repos/stjepang/crossbeam-utils/contributors","subscribers_url":"https://api.github.com/repos/stjepang/crossbeam-utils/subscribers","subscription_url":"https://api.github.com/repos/stjepang/crossbeam-utils/subscription","commits_url":"https://api.github.com/repos/stjepang/crossbeam-utils/commits{/sha}","git_commits_url":"https://api.github.com/repos/stjepang/crossbeam-utils/git/commits{/sha}","comments_url":"https://api.github.com/repos/stjepang/crossbeam-utils/comments{/number}","issue_comment_url":"https://api.github.com/repos/stjepang/crossbeam-utils/issues/comments{/number}","contents_url":"https://api.github.com/repos/stjepang/crossbeam-utils/contents/{+path}","compare_url":"https://api.github.com/repos/stjepang/crossbeam-utils/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stjepang/crossbeam-utils/merges","archive_url":"https://api.github.com/repos/stjepang/crossbeam-utils/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stjepang/crossbeam-utils/downloads","issues_url":"https://api.github.com/repos/stjepang/crossbeam-utils/issues{/number}","pulls_url":"https://api.github.com/repos/stjepang/crossbeam-utils/pulls{/number}","milestones_url":"https://api.github.com/repos/stjepang/crossbeam-utils/milestones{/number}","notifications_url":"https://api.github.com/repos/stjepang/crossbeam-utils/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stjepang/crossbeam-utils/labels{/name}","releases_url":"https://api.github.com/repos/stjepang/crossbeam-utils/releases{/id}","deployments_url":"https://api.github.com/repos/stjepang/crossbeam-utils/deployments","created_at":"2017-09-22T14:30:39Z","updated_at":"2018-07-14T22:11:05Z","pushed_at":"2018-10-02T21:27:14Z","git_url":"git://github.com/stjepang/crossbeam-utils.git","ssh_url":"git@github.com:stjepang/crossbeam-utils.git","clone_url":"https://github.com/stjepang/crossbeam-utils.git","svn_url":"https://github.com/stjepang/crossbeam-utils","homepage":null,"size":80,"stargazers_count":0,"watchers_count":0,"language":"Rust","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":"NOASSERTION","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"crossbeam-rs:master","ref":"master","sha":"2860dd39717e2d8093efae6b637187cfbe16ae82","user":{"login":"crossbeam-rs","id":26314159,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI2MzE0MTU5","avatar_url":"https://avatars0.githubusercontent.com/u/26314159?v=4","gravatar_id":"","url":"https://api.github.com/users/crossbeam-rs","html_url":"https://github.com/crossbeam-rs","followers_url":"https://api.github.com/users/crossbeam-rs/followers","following_url":"https://api.github.com/users/crossbeam-rs/following{/other_user}","gists_url":"https://api.github.com/users/crossbeam-rs/gists{/gist_id}","starred_url":"https://api.github.com/users/crossbeam-rs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crossbeam-rs/subscriptions","organizations_url":"https://api.github.com/users/crossbeam-rs/orgs","repos_url":"https://api.github.com/users/crossbeam-rs/repos","events_url":"https://api.github.com/users/crossbeam-rs/events{/privacy}","received_events_url":"https://api.github.com/users/crossbeam-rs/received_events","type":"Organization","site_admin":false},"repo":{"id":101528984,"node_id":"MDEwOlJlcG9zaXRvcnkxMDE1Mjg5ODQ=","name":"crossbeam-utils","full_name":"crossbeam-rs/crossbeam-utils","private":false,"owner":{"login":"crossbeam-rs","id":26314159,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI2MzE0MTU5","avatar_url":"https://avatars0.githubusercontent.com/u/26314159?v=4","gravatar_id":"","url":"https://api.github.com/users/crossbeam-rs","html_url":"https://github.com/crossbeam-rs","followers_url":"https://api.github.com/users/crossbeam-rs/followers","following_url":"https://api.github.com/users/crossbeam-rs/following{/other_user}","gists_url":"https://api.github.com/users/crossbeam-rs/gists{/gist_id}","starred_url":"https://api.github.com/users/crossbeam-rs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crossbeam-rs/subscriptions","organizations_url":"https://api.github.com/users/crossbeam-rs/orgs","repos_url":"https://api.github.com/users/crossbeam-rs/repos","events_url":"https://api.github.com/users/crossbeam-rs/events{/privacy}","received_events_url":"https://api.github.com/users/crossbeam-rs/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/crossbeam-rs/crossbeam-utils","description":"Utilities for concurrent programming","fork":false,"url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils","forks_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/forks","keys_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/keys{/key_id}","collaborators_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/teams","hooks_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/hooks","issue_events_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/issues/events{/number}","events_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/events","assignees_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/assignees{/user}","branches_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/branches{/branch}","tags_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/tags","blobs_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/git/refs{/sha}","trees_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/git/trees{/sha}","statuses_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/statuses/{sha}","languages_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/languages","stargazers_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/stargazers","contributors_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/contributors","subscribers_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/subscribers","subscription_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/subscription","commits_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/commits{/sha}","git_commits_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/git/commits{/sha}","comments_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/comments{/number}","issue_comment_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/issues/comments{/number}","contents_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/contents/{+path}","compare_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/compare/{base}...{head}","merges_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/merges","archive_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/downloads","issues_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/issues{/number}","pulls_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/pulls{/number}","milestones_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/milestones{/number}","notifications_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/labels{/name}","releases_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/releases{/id}","deployments_url":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/deployments","created_at":"2017-08-27T04:08:42Z","updated_at":"2018-10-01T13:40:37Z","pushed_at":"2018-10-02T21:27:15Z","git_url":"git://github.com/crossbeam-rs/crossbeam-utils.git","ssh_url":"git@github.com:crossbeam-rs/crossbeam-utils.git","clone_url":"https://github.com/crossbeam-rs/crossbeam-utils.git","svn_url":"https://github.com/crossbeam-rs/crossbeam-utils","homepage":null,"size":66,"stargazers_count":32,"watchers_count":32,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"archived":false,"open_issues_count":8,"license":{"key":"other","name":"NOASSERTION","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":10,"open_issues":8,"watchers":32,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/pulls/50"},"html":{"href":"https://github.com/crossbeam-rs/crossbeam-utils/pull/50"},"issue":{"href":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/issues/50"},"comments":{"href":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/issues/50/comments"},"review_comments":{"href":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/pulls/50/comments"},"review_comment":{"href":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/pulls/50/commits"},"statuses":{"href":"https://api.github.com/repos/crossbeam-rs/crossbeam-utils/statuses/f12cdc1b3f2f498e1f5953f652c58acd17cb6ffe"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"stjepang"}}