{"action":"closed","number":929,"pull_request":{"url":"https://api.github.com/repos/apple/swift/pulls/929","id":55553691,"html_url":"https://github.com/apple/swift/pull/929","diff_url":"https://github.com/apple/swift/pull/929.diff","patch_url":"https://github.com/apple/swift/pull/929.patch","issue_url":"https://api.github.com/repos/apple/swift/issues/929","number":929,"state":"closed","locked":false,"title":"[Stdlib] Remove all redundant stdout locking when printing","user":{"login":"kballard","id":714,"avatar_url":"https://avatars.githubusercontent.com/u/714?v=3","gravatar_id":"","url":"https://api.github.com/users/kballard","html_url":"https://github.com/kballard","followers_url":"https://api.github.com/users/kballard/followers","following_url":"https://api.github.com/users/kballard/following{/other_user}","gists_url":"https://api.github.com/users/kballard/gists{/gist_id}","starred_url":"https://api.github.com/users/kballard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kballard/subscriptions","organizations_url":"https://api.github.com/users/kballard/orgs","repos_url":"https://api.github.com/users/kballard/repos","events_url":"https://api.github.com/users/kballard/events{/privacy}","received_events_url":"https://api.github.com/users/kballard/received_events","type":"User","site_admin":false},"body":"* Switch to calling `putchar_unlocked()` instead of `putchar()` for\n  actual printing. We're already locking stdout with `flockfile()`, so\n  there's no need for the redundant lock that `putchar()` uses.\n* Add an explicit lock to the output stream in `dump()`. This means the\n  entire dump is printed with the lock held, which will prevent the\n  output of `dump()` from mixing with prints on other threads.\n* Use `_debugPrint_unlocked()` instead of `debugPrint()` in\n  `_adHocPrint()`. The output stream is already locked while this\n  function is executing. Rename the function to `_adHocPrint_unlocked()`\n  to make this explicit.\n* Use `targetStream.write()` and `_print_unlocked()` instead of\n  `print()` in `_dumpWithMirror()`. This removes the redundant locking,\n  and also eliminates the creation of intermediate strings. Rename the\n  function to `_dumpWithMirror_unlocked()` to make this explicit.\n* Use `_debugPrint_unlocked()` instead of `debugPrint()` in\n  `String.init(reflecting:)`. This shouldn't really make much of a\n  difference but it matches the usage of `_print_unlocked()` in\n  `String.init(_:)`.\n\nThe net result is that all printing is still covered under locks like\nbefore, but stdout is never recursively locked. This should result in\nslightly faster printing. In addition, `dump()` is now covered under a\nsingle lock so it can't mix its output with prints from other threads.","created_at":"2016-01-09T23:31:27Z","updated_at":"2016-02-04T17:15:24Z","closed_at":"2016-02-04T17:15:24Z","merged_at":"2016-02-04T17:15:24Z","merge_commit_sha":"36596c83fc0b914117df3419a3dfd850f6abd9fa","assignee":{"login":"gribozavr","id":1120569,"avatar_url":"https://avatars.githubusercontent.com/u/1120569?v=3","gravatar_id":"","url":"https://api.github.com/users/gribozavr","html_url":"https://github.com/gribozavr","followers_url":"https://api.github.com/users/gribozavr/followers","following_url":"https://api.github.com/users/gribozavr/following{/other_user}","gists_url":"https://api.github.com/users/gribozavr/gists{/gist_id}","starred_url":"https://api.github.com/users/gribozavr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gribozavr/subscriptions","organizations_url":"https://api.github.com/users/gribozavr/orgs","repos_url":"https://api.github.com/users/gribozavr/repos","events_url":"https://api.github.com/users/gribozavr/events{/privacy}","received_events_url":"https://api.github.com/users/gribozavr/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/apple/swift/pulls/929/commits","review_comments_url":"https://api.github.com/repos/apple/swift/pulls/929/comments","review_comment_url":"https://api.github.com/repos/apple/swift/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apple/swift/issues/929/comments","statuses_url":"https://api.github.com/repos/apple/swift/statuses/ac1996000e870b254fb1bebecbee8699607e2fee","head":{"label":"kballard:remove-reundant-locking-from-print","ref":"remove-reundant-locking-from-print","sha":"ac1996000e870b254fb1bebecbee8699607e2fee","user":{"login":"kballard","id":714,"avatar_url":"https://avatars.githubusercontent.com/u/714?v=3","gravatar_id":"","url":"https://api.github.com/users/kballard","html_url":"https://github.com/kballard","followers_url":"https://api.github.com/users/kballard/followers","following_url":"https://api.github.com/users/kballard/following{/other_user}","gists_url":"https://api.github.com/users/kballard/gists{/gist_id}","starred_url":"https://api.github.com/users/kballard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kballard/subscriptions","organizations_url":"https://api.github.com/users/kballard/orgs","repos_url":"https://api.github.com/users/kballard/repos","events_url":"https://api.github.com/users/kballard/events{/privacy}","received_events_url":"https://api.github.com/users/kballard/received_events","type":"User","site_admin":false},"repo":{"id":47383591,"name":"swift","full_name":"kballard/swift","owner":{"login":"kballard","id":714,"avatar_url":"https://avatars.githubusercontent.com/u/714?v=3","gravatar_id":"","url":"https://api.github.com/users/kballard","html_url":"https://github.com/kballard","followers_url":"https://api.github.com/users/kballard/followers","following_url":"https://api.github.com/users/kballard/following{/other_user}","gists_url":"https://api.github.com/users/kballard/gists{/gist_id}","starred_url":"https://api.github.com/users/kballard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kballard/subscriptions","organizations_url":"https://api.github.com/users/kballard/orgs","repos_url":"https://api.github.com/users/kballard/repos","events_url":"https://api.github.com/users/kballard/events{/privacy}","received_events_url":"https://api.github.com/users/kballard/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kballard/swift","description":"The Swift Programming Language","fork":true,"url":"https://api.github.com/repos/kballard/swift","forks_url":"https://api.github.com/repos/kballard/swift/forks","keys_url":"https://api.github.com/repos/kballard/swift/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kballard/swift/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kballard/swift/teams","hooks_url":"https://api.github.com/repos/kballard/swift/hooks","issue_events_url":"https://api.github.com/repos/kballard/swift/issues/events{/number}","events_url":"https://api.github.com/repos/kballard/swift/events","assignees_url":"https://api.github.com/repos/kballard/swift/assignees{/user}","branches_url":"https://api.github.com/repos/kballard/swift/branches{/branch}","tags_url":"https://api.github.com/repos/kballard/swift/tags","blobs_url":"https://api.github.com/repos/kballard/swift/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kballard/swift/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kballard/swift/git/refs{/sha}","trees_url":"https://api.github.com/repos/kballard/swift/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kballard/swift/statuses/{sha}","languages_url":"https://api.github.com/repos/kballard/swift/languages","stargazers_url":"https://api.github.com/repos/kballard/swift/stargazers","contributors_url":"https://api.github.com/repos/kballard/swift/contributors","subscribers_url":"https://api.github.com/repos/kballard/swift/subscribers","subscription_url":"https://api.github.com/repos/kballard/swift/subscription","commits_url":"https://api.github.com/repos/kballard/swift/commits{/sha}","git_commits_url":"https://api.github.com/repos/kballard/swift/git/commits{/sha}","comments_url":"https://api.github.com/repos/kballard/swift/comments{/number}","issue_comment_url":"https://api.github.com/repos/kballard/swift/issues/comments{/number}","contents_url":"https://api.github.com/repos/kballard/swift/contents/{+path}","compare_url":"https://api.github.com/repos/kballard/swift/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kballard/swift/merges","archive_url":"https://api.github.com/repos/kballard/swift/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kballard/swift/downloads","issues_url":"https://api.github.com/repos/kballard/swift/issues{/number}","pulls_url":"https://api.github.com/repos/kballard/swift/pulls{/number}","milestones_url":"https://api.github.com/repos/kballard/swift/milestones{/number}","notifications_url":"https://api.github.com/repos/kballard/swift/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kballard/swift/labels{/name}","releases_url":"https://api.github.com/repos/kballard/swift/releases{/id}","deployments_url":"https://api.github.com/repos/kballard/swift/deployments","created_at":"2015-12-04T05:37:18Z","updated_at":"2015-12-04T05:37:45Z","pushed_at":"2016-02-02T22:14:59Z","git_url":"git://github.com/kballard/swift.git","ssh_url":"git@github.com:kballard/swift.git","clone_url":"https://github.com/kballard/swift.git","svn_url":"https://github.com/kballard/swift","homepage":"","size":71185,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apple:master","ref":"master","sha":"35bce55e623093c7a93ab1ede2290ebae8508eb4","user":{"login":"apple","id":10639145,"avatar_url":"https://avatars.githubusercontent.com/u/10639145?v=3","gravatar_id":"","url":"https://api.github.com/users/apple","html_url":"https://github.com/apple","followers_url":"https://api.github.com/users/apple/followers","following_url":"https://api.github.com/users/apple/following{/other_user}","gists_url":"https://api.github.com/users/apple/gists{/gist_id}","starred_url":"https://api.github.com/users/apple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apple/subscriptions","organizations_url":"https://api.github.com/users/apple/orgs","repos_url":"https://api.github.com/users/apple/repos","events_url":"https://api.github.com/users/apple/events{/privacy}","received_events_url":"https://api.github.com/users/apple/received_events","type":"Organization","site_admin":false},"repo":{"id":44838949,"name":"swift","full_name":"apple/swift","owner":{"login":"apple","id":10639145,"avatar_url":"https://avatars.githubusercontent.com/u/10639145?v=3","gravatar_id":"","url":"https://api.github.com/users/apple","html_url":"https://github.com/apple","followers_url":"https://api.github.com/users/apple/followers","following_url":"https://api.github.com/users/apple/following{/other_user}","gists_url":"https://api.github.com/users/apple/gists{/gist_id}","starred_url":"https://api.github.com/users/apple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apple/subscriptions","organizations_url":"https://api.github.com/users/apple/orgs","repos_url":"https://api.github.com/users/apple/repos","events_url":"https://api.github.com/users/apple/events{/privacy}","received_events_url":"https://api.github.com/users/apple/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apple/swift","description":"The Swift Programming Language","fork":false,"url":"https://api.github.com/repos/apple/swift","forks_url":"https://api.github.com/repos/apple/swift/forks","keys_url":"https://api.github.com/repos/apple/swift/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apple/swift/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apple/swift/teams","hooks_url":"https://api.github.com/repos/apple/swift/hooks","issue_events_url":"https://api.github.com/repos/apple/swift/issues/events{/number}","events_url":"https://api.github.com/repos/apple/swift/events","assignees_url":"https://api.github.com/repos/apple/swift/assignees{/user}","branches_url":"https://api.github.com/repos/apple/swift/branches{/branch}","tags_url":"https://api.github.com/repos/apple/swift/tags","blobs_url":"https://api.github.com/repos/apple/swift/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apple/swift/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apple/swift/git/refs{/sha}","trees_url":"https://api.github.com/repos/apple/swift/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apple/swift/statuses/{sha}","languages_url":"https://api.github.com/repos/apple/swift/languages","stargazers_url":"https://api.github.com/repos/apple/swift/stargazers","contributors_url":"https://api.github.com/repos/apple/swift/contributors","subscribers_url":"https://api.github.com/repos/apple/swift/subscribers","subscription_url":"https://api.github.com/repos/apple/swift/subscription","commits_url":"https://api.github.com/repos/apple/swift/commits{/sha}","git_commits_url":"https://api.github.com/repos/apple/swift/git/commits{/sha}","comments_url":"https://api.github.com/repos/apple/swift/comments{/number}","issue_comment_url":"https://api.github.com/repos/apple/swift/issues/comments{/number}","contents_url":"https://api.github.com/repos/apple/swift/contents/{+path}","compare_url":"https://api.github.com/repos/apple/swift/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apple/swift/merges","archive_url":"https://api.github.com/repos/apple/swift/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apple/swift/downloads","issues_url":"https://api.github.com/repos/apple/swift/issues{/number}","pulls_url":"https://api.github.com/repos/apple/swift/pulls{/number}","milestones_url":"https://api.github.com/repos/apple/swift/milestones{/number}","notifications_url":"https://api.github.com/repos/apple/swift/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apple/swift/labels{/name}","releases_url":"https://api.github.com/repos/apple/swift/releases{/id}","deployments_url":"https://api.github.com/repos/apple/swift/deployments","created_at":"2015-10-23T21:15:07Z","updated_at":"2016-02-04T16:21:43Z","pushed_at":"2016-02-04T17:15:24Z","git_url":"git://github.com/apple/swift.git","ssh_url":"git@github.com:apple/swift.git","clone_url":"https://github.com/apple/swift.git","svn_url":"https://github.com/apple/swift","homepage":"https://swift.org/","size":106756,"stargazers_count":26412,"watchers_count":26412,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3365,"mirror_url":null,"open_issues_count":55,"forks":3365,"open_issues":55,"watchers":26412,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apple/swift/pulls/929"},"html":{"href":"https://github.com/apple/swift/pull/929"},"issue":{"href":"https://api.github.com/repos/apple/swift/issues/929"},"comments":{"href":"https://api.github.com/repos/apple/swift/issues/929/comments"},"review_comments":{"href":"https://api.github.com/repos/apple/swift/pulls/929/comments"},"review_comment":{"href":"https://api.github.com/repos/apple/swift/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apple/swift/pulls/929/commits"},"statuses":{"href":"https://api.github.com/repos/apple/swift/statuses/ac1996000e870b254fb1bebecbee8699607e2fee"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"gribozavr","id":1120569,"avatar_url":"https://avatars.githubusercontent.com/u/1120569?v=3","gravatar_id":"","url":"https://api.github.com/users/gribozavr","html_url":"https://github.com/gribozavr","followers_url":"https://api.github.com/users/gribozavr/followers","following_url":"https://api.github.com/users/gribozavr/following{/other_user}","gists_url":"https://api.github.com/users/gribozavr/gists{/gist_id}","starred_url":"https://api.github.com/users/gribozavr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gribozavr/subscriptions","organizations_url":"https://api.github.com/users/gribozavr/orgs","repos_url":"https://api.github.com/users/gribozavr/repos","events_url":"https://api.github.com/users/gribozavr/events{/privacy}","received_events_url":"https://api.github.com/users/gribozavr/received_events","type":"User","site_admin":false},"comments":7,"review_comments":0,"commits":1,"additions":59,"deletions":49,"changed_files":6}}