{"action":"created","comment":{"url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/pulls/comments/26375991","id":26375991,"diff_hunk":"@@ -32,37 +27,80 @@ module Concurrent\n         describe '#wait without timeout' do\n \n           it 'should block the thread' do\n-            t = Thread.new { mutex.synchronize { subject.wait(mutex) } }\n-            sleep(0.1)\n-            expect(t.status).to eq 'sleep'\n+            latch_1 = Concurrent::CountDownLatch.new\n+            latch_2 = Concurrent::CountDownLatch.new\n+            mutex = Mutex.new\n+\n+            t = Thread.new do\n+              mutex.synchronize do\n+                latch_1.count_down\n+                subject.wait(mutex)\n+                latch_2.count_down\n+              end\n+            end\n+\n+            latch_1.wait(1)\n+            latch_2.wait(0.1)","path":"spec/concurrent/atomic/condition_spec.rb","position":36,"original_position":36,"commit_id":"eb5c8d53c713883c477c550441e9ef2f4c6236a3","original_commit_id":"eb5c8d53c713883c477c550441e9ef2f4c6236a3","user":{"login":"pitr-ch","id":204460,"avatar_url":"https://avatars.githubusercontent.com/u/204460?v=3","gravatar_id":"","url":"https://api.github.com/users/pitr-ch","html_url":"https://github.com/pitr-ch","followers_url":"https://api.github.com/users/pitr-ch/followers","following_url":"https://api.github.com/users/pitr-ch/following{/other_user}","gists_url":"https://api.github.com/users/pitr-ch/gists{/gist_id}","starred_url":"https://api.github.com/users/pitr-ch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pitr-ch/subscriptions","organizations_url":"https://api.github.com/users/pitr-ch/orgs","repos_url":"https://api.github.com/users/pitr-ch/repos","events_url":"https://api.github.com/users/pitr-ch/events{/privacy}","received_events_url":"https://api.github.com/users/pitr-ch/received_events","type":"User","site_admin":false},"body":"It might be better practice to use Events in similar cases giving the variable some name for improved readability. \r\n```ruby\r\n  before_waiting = Concurrent::Event.new\r\n  after_waiting = Concurrent::Event.new\r\n  mutex = Mutex.new\r\n\r\n  thread = Thread.new do\r\n    mutex.synchronize do\r\n      before_waiting.set\r\n      subject.wait(mutex)\r\n      after_waiting.set\r\n    end\r\n  end\r\n\r\n  before_waiting.wait(1)\r\n  after_waiting.wait(0.1)\r\n  expect(after_waiting.set?).to be_false\r\n  thread.kill\r\n```\r\nBut both latch and event cannot be used here because both depend on the `Condition` which is being testes here. `Queue` may be good replacement here.","created_at":"2015-03-13T10:29:27Z","updated_at":"2015-03-13T10:29:27Z","html_url":"https://github.com/ruby-concurrency/concurrent-ruby/pull/262#discussion_r26375991","pull_request_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/pulls/262","_links":{"self":{"href":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/pulls/comments/26375991"},"html":{"href":"https://github.com/ruby-concurrency/concurrent-ruby/pull/262#discussion_r26375991"},"pull_request":{"href":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/pulls/262"}}},"pull_request":{"url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/pulls/262","id":30683096,"html_url":"https://github.com/ruby-concurrency/concurrent-ruby/pull/262","diff_url":"https://github.com/ruby-concurrency/concurrent-ruby/pull/262.diff","patch_url":"https://github.com/ruby-concurrency/concurrent-ruby/pull/262.patch","issue_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/issues/262","number":262,"state":"closed","locked":false,"title":"Fix Intermittently Failing Tests","user":{"login":"jdantonio","id":173910,"avatar_url":"https://avatars.githubusercontent.com/u/173910?v=3","gravatar_id":"","url":"https://api.github.com/users/jdantonio","html_url":"https://github.com/jdantonio","followers_url":"https://api.github.com/users/jdantonio/followers","following_url":"https://api.github.com/users/jdantonio/following{/other_user}","gists_url":"https://api.github.com/users/jdantonio/gists{/gist_id}","starred_url":"https://api.github.com/users/jdantonio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdantonio/subscriptions","organizations_url":"https://api.github.com/users/jdantonio/orgs","repos_url":"https://api.github.com/users/jdantonio/repos","events_url":"https://api.github.com/users/jdantonio/events{/privacy}","received_events_url":"https://api.github.com/users/jdantonio/received_events","type":"User","site_admin":false},"body":"Addresses #117 and #263","created_at":"2015-03-06T21:55:20Z","updated_at":"2015-03-13T10:29:27Z","closed_at":"2015-03-07T20:19:01Z","merged_at":"2015-03-07T20:19:01Z","merge_commit_sha":"761513f57556577ba8dd51b6ce73a4abbf1dfa5f","assignee":{"login":"jdantonio","id":173910,"avatar_url":"https://avatars.githubusercontent.com/u/173910?v=3","gravatar_id":"","url":"https://api.github.com/users/jdantonio","html_url":"https://github.com/jdantonio","followers_url":"https://api.github.com/users/jdantonio/followers","following_url":"https://api.github.com/users/jdantonio/following{/other_user}","gists_url":"https://api.github.com/users/jdantonio/gists{/gist_id}","starred_url":"https://api.github.com/users/jdantonio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdantonio/subscriptions","organizations_url":"https://api.github.com/users/jdantonio/orgs","repos_url":"https://api.github.com/users/jdantonio/repos","events_url":"https://api.github.com/users/jdantonio/events{/privacy}","received_events_url":"https://api.github.com/users/jdantonio/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/milestones/8","html_url":"https://github.com/ruby-concurrency/concurrent-ruby/milestones/1.0.0%20Release","labels_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/milestones/8/labels","id":846255,"number":8,"title":"1.0.0 Release","description":"See #257 ","creator":{"login":"pitr-ch","id":204460,"avatar_url":"https://avatars.githubusercontent.com/u/204460?v=3","gravatar_id":"","url":"https://api.github.com/users/pitr-ch","html_url":"https://github.com/pitr-ch","followers_url":"https://api.github.com/users/pitr-ch/followers","following_url":"https://api.github.com/users/pitr-ch/following{/other_user}","gists_url":"https://api.github.com/users/pitr-ch/gists{/gist_id}","starred_url":"https://api.github.com/users/pitr-ch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pitr-ch/subscriptions","organizations_url":"https://api.github.com/users/pitr-ch/orgs","repos_url":"https://api.github.com/users/pitr-ch/repos","events_url":"https://api.github.com/users/pitr-ch/events{/privacy}","received_events_url":"https://api.github.com/users/pitr-ch/received_events","type":"User","site_admin":false},"open_issues":10,"closed_issues":5,"state":"open","created_at":"2014-10-30T08:00:45Z","updated_at":"2015-03-11T20:15:57Z","due_on":"2015-07-17T04:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/pulls/262/commits","review_comments_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/pulls/262/comments","review_comment_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/issues/262/comments","statuses_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/statuses/eb5c8d53c713883c477c550441e9ef2f4c6236a3","head":{"label":"ruby-concurrency:refactor/tests","ref":"refactor/tests","sha":"eb5c8d53c713883c477c550441e9ef2f4c6236a3","user":{"login":"ruby-concurrency","id":5462766,"avatar_url":"https://avatars.githubusercontent.com/u/5462766?v=3","gravatar_id":"","url":"https://api.github.com/users/ruby-concurrency","html_url":"https://github.com/ruby-concurrency","followers_url":"https://api.github.com/users/ruby-concurrency/followers","following_url":"https://api.github.com/users/ruby-concurrency/following{/other_user}","gists_url":"https://api.github.com/users/ruby-concurrency/gists{/gist_id}","starred_url":"https://api.github.com/users/ruby-concurrency/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruby-concurrency/subscriptions","organizations_url":"https://api.github.com/users/ruby-concurrency/orgs","repos_url":"https://api.github.com/users/ruby-concurrency/repos","events_url":"https://api.github.com/users/ruby-concurrency/events{/privacy}","received_events_url":"https://api.github.com/users/ruby-concurrency/received_events","type":"Organization","site_admin":false},"repo":{"id":11607598,"name":"concurrent-ruby","full_name":"ruby-concurrency/concurrent-ruby","owner":{"login":"ruby-concurrency","id":5462766,"avatar_url":"https://avatars.githubusercontent.com/u/5462766?v=3","gravatar_id":"","url":"https://api.github.com/users/ruby-concurrency","html_url":"https://github.com/ruby-concurrency","followers_url":"https://api.github.com/users/ruby-concurrency/followers","following_url":"https://api.github.com/users/ruby-concurrency/following{/other_user}","gists_url":"https://api.github.com/users/ruby-concurrency/gists{/gist_id}","starred_url":"https://api.github.com/users/ruby-concurrency/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruby-concurrency/subscriptions","organizations_url":"https://api.github.com/users/ruby-concurrency/orgs","repos_url":"https://api.github.com/users/ruby-concurrency/repos","events_url":"https://api.github.com/users/ruby-concurrency/events{/privacy}","received_events_url":"https://api.github.com/users/ruby-concurrency/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ruby-concurrency/concurrent-ruby","description":"Modern concurrency tools including agents, futures, promises, thread pools, supervisors, and more. Inspired by Erlang, Clojure, Scala, Go, Java, JavaScript, and classic concurrency patterns.","fork":false,"url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby","forks_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/forks","keys_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/teams","hooks_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/hooks","issue_events_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/issues/events{/number}","events_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/events","assignees_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/assignees{/user}","branches_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/branches{/branch}","tags_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/tags","blobs_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/git/refs{/sha}","trees_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/statuses/{sha}","languages_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/languages","stargazers_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/stargazers","contributors_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/contributors","subscribers_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/subscribers","subscription_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/subscription","commits_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/commits{/sha}","git_commits_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/git/commits{/sha}","comments_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/comments{/number}","issue_comment_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/issues/comments{/number}","contents_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/contents/{+path}","compare_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/merges","archive_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/downloads","issues_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/issues{/number}","pulls_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/pulls{/number}","milestones_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/milestones{/number}","notifications_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/labels{/name}","releases_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/releases{/id}","created_at":"2013-07-23T12:19:51Z","updated_at":"2015-03-13T03:34:25Z","pushed_at":"2015-03-11T15:37:41Z","git_url":"git://github.com/ruby-concurrency/concurrent-ruby.git","ssh_url":"git@github.com:ruby-concurrency/concurrent-ruby.git","clone_url":"https://github.com/ruby-concurrency/concurrent-ruby.git","svn_url":"https://github.com/ruby-concurrency/concurrent-ruby","homepage":"http://www.concurrent-ruby.com","size":15732,"stargazers_count":1231,"watchers_count":1231,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":62,"mirror_url":null,"open_issues_count":26,"forks":62,"open_issues":26,"watchers":1231,"default_branch":"master"}},"base":{"label":"ruby-concurrency:master","ref":"master","sha":"2859060923be3435eb054c2bf6f678f43a02f4f3","user":{"login":"ruby-concurrency","id":5462766,"avatar_url":"https://avatars.githubusercontent.com/u/5462766?v=3","gravatar_id":"","url":"https://api.github.com/users/ruby-concurrency","html_url":"https://github.com/ruby-concurrency","followers_url":"https://api.github.com/users/ruby-concurrency/followers","following_url":"https://api.github.com/users/ruby-concurrency/following{/other_user}","gists_url":"https://api.github.com/users/ruby-concurrency/gists{/gist_id}","starred_url":"https://api.github.com/users/ruby-concurrency/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruby-concurrency/subscriptions","organizations_url":"https://api.github.com/users/ruby-concurrency/orgs","repos_url":"https://api.github.com/users/ruby-concurrency/repos","events_url":"https://api.github.com/users/ruby-concurrency/events{/privacy}","received_events_url":"https://api.github.com/users/ruby-concurrency/received_events","type":"Organization","site_admin":false},"repo":{"id":11607598,"name":"concurrent-ruby","full_name":"ruby-concurrency/concurrent-ruby","owner":{"login":"ruby-concurrency","id":5462766,"avatar_url":"https://avatars.githubusercontent.com/u/5462766?v=3","gravatar_id":"","url":"https://api.github.com/users/ruby-concurrency","html_url":"https://github.com/ruby-concurrency","followers_url":"https://api.github.com/users/ruby-concurrency/followers","following_url":"https://api.github.com/users/ruby-concurrency/following{/other_user}","gists_url":"https://api.github.com/users/ruby-concurrency/gists{/gist_id}","starred_url":"https://api.github.com/users/ruby-concurrency/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruby-concurrency/subscriptions","organizations_url":"https://api.github.com/users/ruby-concurrency/orgs","repos_url":"https://api.github.com/users/ruby-concurrency/repos","events_url":"https://api.github.com/users/ruby-concurrency/events{/privacy}","received_events_url":"https://api.github.com/users/ruby-concurrency/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ruby-concurrency/concurrent-ruby","description":"Modern concurrency tools including agents, futures, promises, thread pools, supervisors, and more. Inspired by Erlang, Clojure, Scala, Go, Java, JavaScript, and classic concurrency patterns.","fork":false,"url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby","forks_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/forks","keys_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/teams","hooks_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/hooks","issue_events_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/issues/events{/number}","events_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/events","assignees_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/assignees{/user}","branches_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/branches{/branch}","tags_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/tags","blobs_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/git/refs{/sha}","trees_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/statuses/{sha}","languages_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/languages","stargazers_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/stargazers","contributors_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/contributors","subscribers_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/subscribers","subscription_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/subscription","commits_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/commits{/sha}","git_commits_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/git/commits{/sha}","comments_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/comments{/number}","issue_comment_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/issues/comments{/number}","contents_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/contents/{+path}","compare_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/merges","archive_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/downloads","issues_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/issues{/number}","pulls_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/pulls{/number}","milestones_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/milestones{/number}","notifications_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/labels{/name}","releases_url":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/releases{/id}","created_at":"2013-07-23T12:19:51Z","updated_at":"2015-03-13T03:34:25Z","pushed_at":"2015-03-11T15:37:41Z","git_url":"git://github.com/ruby-concurrency/concurrent-ruby.git","ssh_url":"git@github.com:ruby-concurrency/concurrent-ruby.git","clone_url":"https://github.com/ruby-concurrency/concurrent-ruby.git","svn_url":"https://github.com/ruby-concurrency/concurrent-ruby","homepage":"http://www.concurrent-ruby.com","size":15732,"stargazers_count":1231,"watchers_count":1231,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":62,"mirror_url":null,"open_issues_count":26,"forks":62,"open_issues":26,"watchers":1231,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/pulls/262"},"html":{"href":"https://github.com/ruby-concurrency/concurrent-ruby/pull/262"},"issue":{"href":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/issues/262"},"comments":{"href":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/issues/262/comments"},"review_comments":{"href":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/pulls/262/comments"},"review_comment":{"href":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/pulls/262/commits"},"statuses":{"href":"https://api.github.com/repos/ruby-concurrency/concurrent-ruby/statuses/eb5c8d53c713883c477c550441e9ef2f4c6236a3"}}}}