{"action":"created","issue":{"url":"https://api.github.com/repos/apple/swift/issues/1731","repository_url":"https://api.github.com/repos/apple/swift","labels_url":"https://api.github.com/repos/apple/swift/issues/1731/labels{/name}","comments_url":"https://api.github.com/repos/apple/swift/issues/1731/comments","events_url":"https://api.github.com/repos/apple/swift/issues/1731/events","html_url":"https://github.com/apple/swift/pull/1731","id":141790033,"number":1731,"title":"SR-946 - Unify mutexes in the Swift runtime","user":{"login":"shawnce","id":352255,"avatar_url":"https://avatars.githubusercontent.com/u/352255?v=3","gravatar_id":"","url":"https://api.github.com/users/shawnce","html_url":"https://github.com/shawnce","followers_url":"https://api.github.com/users/shawnce/followers","following_url":"https://api.github.com/users/shawnce/following{/other_user}","gists_url":"https://api.github.com/users/shawnce/gists{/gist_id}","starred_url":"https://api.github.com/users/shawnce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shawnce/subscriptions","organizations_url":"https://api.github.com/users/shawnce/orgs","repos_url":"https://api.github.com/users/shawnce/repos","events_url":"https://api.github.com/users/shawnce/events{/privacy}","received_events_url":"https://api.github.com/users/shawnce/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":31,"created_at":"2016-03-18T06:54:31Z","updated_at":"2016-03-30T19:51:32Z","closed_at":"2016-03-29T15:56:39Z","pull_request":{"url":"https://api.github.com/repos/apple/swift/pulls/1731","html_url":"https://github.com/apple/swift/pull/1731","diff_url":"https://github.com/apple/swift/pull/1731.diff","patch_url":"https://github.com/apple/swift/pull/1731.patch"},"body":"<!-- Please complete this template before creating pull request. -->\r\n#### What's in this pull request?\r\nThe changes in this pull request addresses SR-946 by adding swift::Mutex, swift:Condition, swift::ScopedLock, and swift::ScopedUnlock to the swift runtime. Existing swift runtime code was converted over to use these new classes and off of pthread_mutex directly and/or std::mutex.\r\n\r\nNote two locations in the runtime continue to use pthread_mutex and pthread_rwlock (comments added to affected source code). Those will be corrected in a later pull request / SR as needed.\r\n\r\n_My original branch got in a bad state after running update-checkout that prevented me from pushing (or force pushing). I had to remove the old branch and recreate by cherry picking my work. The original PR related to these changes was #1700. Sorry about that!_\r\n\r\n#### Resolved bug number: ([SR-946](https://bugs.swift.org/browse/SR-946))\r\n<!-- If this pull request resolves any bugs from Swift bug tracker -->\r\n\r\n* * * *\r\n\r\n<!-- This selection should only be completed by Swift admin -->\r\nBefore merging this pull request to apple/swift repository:\r\n- [ ] Test pull request on Swift continuous integration.\r\n\r\n<details>\r\n  <summary>Triggering Swift CI</summary>\r\n\r\nThe swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:\r\n\r\n**Smoke Testing**\r\n\r\n        Platform     | Comment\r\n        ------------ | -------------\r\n        All supported platforms     | @swift-ci Please smoke test\r\n        OS X platform               | @swift-ci Please smoke test OS X platform\r\n        Linux platform              | @swift-ci Please smoke test Linux platform\r\n\r\n **Validation Testing**\r\n\r\n        Platform     | Comment\r\n        ------------ | -------------\r\n        All supported platforms     | @swift-ci Please test\r\n        OS X platform               | @swift-ci Please test OS X platform\r\n        Linux platform              | @swift-ci Please test Linux platform\r\n\r\nNote: Only members of the Apple organization can trigger swift-ci.\r\n</details>\r\n<!-- Thank you for your contribution to Swift! -->"},"comment":{"url":"https://api.github.com/repos/apple/swift/issues/comments/203605982","html_url":"https://github.com/apple/swift/pull/1731#issuecomment-203605982","issue_url":"https://api.github.com/repos/apple/swift/issues/1731","id":203605982,"user":{"login":"jckarter","id":147281,"avatar_url":"https://avatars.githubusercontent.com/u/147281?v=3","gravatar_id":"","url":"https://api.github.com/users/jckarter","html_url":"https://github.com/jckarter","followers_url":"https://api.github.com/users/jckarter/followers","following_url":"https://api.github.com/users/jckarter/following{/other_user}","gists_url":"https://api.github.com/users/jckarter/gists{/gist_id}","starred_url":"https://api.github.com/users/jckarter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jckarter/subscriptions","organizations_url":"https://api.github.com/users/jckarter/orgs","repos_url":"https://api.github.com/users/jckarter/repos","events_url":"https://api.github.com/users/jckarter/events{/privacy}","received_events_url":"https://api.github.com/users/jckarter/received_events","type":"User","site_admin":false},"created_at":"2016-03-30T19:51:32Z","updated_at":"2016-03-30T19:51:32Z","body":"@shawnce Our Linux CI bots are timing out on your mutex test:\r\n\r\n```\r\n(lldb) bt\r\n* thread #1: tid = 45337, 0x00007f167bfeff2c libpthread.so.0`__lll_lock_wait + 28, name = 'SwiftRuntimeTes', stop reason = signal SIGSTOP\r\n    frame #0: 0x00007f167bfeff2c libpthread.so.0`__lll_lock_wait + 28\r\n    frame #1: 0x00007f167bfeb657 libpthread.so.0`_L_lock_909 + 15\r\n    frame #2: 0x00007f167bfeb480 libpthread.so.0`__GI___pthread_mutex_lock + 112\r\n    frame #3: 0x00000000004cb0ec SwiftRuntimeTests`swift::MutexImpl::lock() + 12\r\n  * frame #4: 0x0000000000443ba6 SwiftRuntimeTests`MutexTest_LockableThreaded_Test::TestBody() + 630\r\n    frame #5: 0x000000000045da71 SwiftRuntimeTests`testing::Test::Run() + 801\r\n    frame #6: 0x000000000045f180 SwiftRuntimeTests`testing::TestInfo::Run() + 816\r\n    frame #7: 0x000000000045f8a3 SwiftRuntimeTests`testing::TestCase::Run() + 451\r\n    frame #8: 0x0000000000467d69 SwiftRuntimeTests`testing::internal::UnitTestImpl::RunAllTests() + 1417\r\n    frame #9: 0x00000000004677ca SwiftRuntimeTests`testing::UnitTest::Run() + 106\r\n    frame #10: 0x00000000004783eb SwiftRuntimeTests`main + 75\r\n    frame #11: 0x00007f167b41dec5 libc.so.6`__libc_start_main + 245\r\n    frame #12: 0x0000000000429dd6 SwiftRuntimeTests`_start + 41\r\n```"}}