{"action":"created","comment":{"url":"https://api.github.com/repos/gabime/spdlog/pulls/comments/78914896","id":78914896,"diff_hunk":"@@ -39,26 +40,23 @@ class async_logger :public logger\n                  const It& begin,\n                  const It& end,\n                  size_t queue_size,","path":"include/spdlog/async_logger.h","position":11,"original_position":11,"commit_id":"977415361293f7d9442bd216a495989162a2f13e","original_commit_id":"977415361293f7d9442bd216a495989162a2f13e","user":{"login":"facontidavide","id":2822888,"avatar_url":"https://avatars.githubusercontent.com/u/2822888?v=3","gravatar_id":"","url":"https://api.github.com/users/facontidavide","html_url":"https://github.com/facontidavide","followers_url":"https://api.github.com/users/facontidavide/followers","following_url":"https://api.github.com/users/facontidavide/following{/other_user}","gists_url":"https://api.github.com/users/facontidavide/gists{/gist_id}","starred_url":"https://api.github.com/users/facontidavide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facontidavide/subscriptions","organizations_url":"https://api.github.com/users/facontidavide/orgs","repos_url":"https://api.github.com/users/facontidavide/repos","events_url":"https://api.github.com/users/facontidavide/events{/privacy}","received_events_url":"https://api.github.com/users/facontidavide/received_events","type":"User","site_admin":false},"body":"Note: worker_warmup_cb and worker_teardown_cb were moved to the thread pool.","created_at":"2016-09-15T08:41:13Z","updated_at":"2016-09-15T08:41:13Z","html_url":"https://github.com/gabime/spdlog/pull/278#discussion_r78914896","pull_request_url":"https://api.github.com/repos/gabime/spdlog/pulls/278","_links":{"self":{"href":"https://api.github.com/repos/gabime/spdlog/pulls/comments/78914896"},"html":{"href":"https://github.com/gabime/spdlog/pull/278#discussion_r78914896"},"pull_request":{"href":"https://api.github.com/repos/gabime/spdlog/pulls/278"}}},"pull_request":{"url":"https://api.github.com/repos/gabime/spdlog/pulls/278","id":84868557,"html_url":"https://github.com/gabime/spdlog/pull/278","diff_url":"https://github.com/gabime/spdlog/pull/278.diff","patch_url":"https://github.com/gabime/spdlog/pull/278.patch","issue_url":"https://api.github.com/repos/gabime/spdlog/issues/278","number":278,"state":"open","locked":false,"title":"New approach to async: use thread pool to consume the queues.","user":{"login":"facontidavide","id":2822888,"avatar_url":"https://avatars.githubusercontent.com/u/2822888?v=3","gravatar_id":"","url":"https://api.github.com/users/facontidavide","html_url":"https://github.com/facontidavide","followers_url":"https://api.github.com/users/facontidavide/followers","following_url":"https://api.github.com/users/facontidavide/following{/other_user}","gists_url":"https://api.github.com/users/facontidavide/gists{/gist_id}","starred_url":"https://api.github.com/users/facontidavide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facontidavide/subscriptions","organizations_url":"https://api.github.com/users/facontidavide/orgs","repos_url":"https://api.github.com/users/facontidavide/repos","events_url":"https://api.github.com/users/facontidavide/events{/privacy}","received_events_url":"https://api.github.com/users/facontidavide/received_events","type":"User","site_admin":false},"body":"Hi,\r\n\r\nthis is a PR related to https://github.com/gabime/spdlog/issues/275\r\n\r\nThe new implementation use a __thread pool__ with 1 or more threads to serve ALL the `async_loggers` in the process.\r\n\r\nThere is still a single queue for each logger; error handling, flush and push should work as usual.\r\nAll the unit tests pass and the benchmark has the same throughput as before.\r\n\r\nThe way the thread_pool consumes the messages in the queue(s) is a bit counter-intuitive, but is necessary if we don't want to modify the semantic of `flush()` and queue_size.\r\n\r\n1) Each `async_logger` passes function pointer (called further \"handle\") pointing to __`spdlog::details::async_log_helper::worker_loop()`__ to the pool. By the way, that method is not a loop anymore. \r\n2) using __std::weak_ptr__, the pool is able to disconnect automatically the handle of any destroyed instance of `async_log_helper`.\r\n3) The workers cycle through the available handles (one per async_logger) to find one that needs to be served.\r\n\r\nIt is quite a large change and I am not 100% sure that you want to accept this PR without any further modification. The user facing APi and the expected behaviour should be the same, though.\r\n","created_at":"2016-09-12T13:12:48Z","updated_at":"2016-09-15T08:41:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4f85ad2c90680a8b20d115969cd9e74d51c6e042","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/gabime/spdlog/pulls/278/commits","review_comments_url":"https://api.github.com/repos/gabime/spdlog/pulls/278/comments","review_comment_url":"https://api.github.com/repos/gabime/spdlog/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gabime/spdlog/issues/278/comments","statuses_url":"https://api.github.com/repos/gabime/spdlog/statuses/977415361293f7d9442bd216a495989162a2f13e","head":{"label":"facontidavide:thread_pool","ref":"thread_pool","sha":"977415361293f7d9442bd216a495989162a2f13e","user":{"login":"facontidavide","id":2822888,"avatar_url":"https://avatars.githubusercontent.com/u/2822888?v=3","gravatar_id":"","url":"https://api.github.com/users/facontidavide","html_url":"https://github.com/facontidavide","followers_url":"https://api.github.com/users/facontidavide/followers","following_url":"https://api.github.com/users/facontidavide/following{/other_user}","gists_url":"https://api.github.com/users/facontidavide/gists{/gist_id}","starred_url":"https://api.github.com/users/facontidavide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facontidavide/subscriptions","organizations_url":"https://api.github.com/users/facontidavide/orgs","repos_url":"https://api.github.com/users/facontidavide/repos","events_url":"https://api.github.com/users/facontidavide/events{/privacy}","received_events_url":"https://api.github.com/users/facontidavide/received_events","type":"User","site_admin":false},"repo":{"id":67815842,"name":"spdlog","full_name":"facontidavide/spdlog","owner":{"login":"facontidavide","id":2822888,"avatar_url":"https://avatars.githubusercontent.com/u/2822888?v=3","gravatar_id":"","url":"https://api.github.com/users/facontidavide","html_url":"https://github.com/facontidavide","followers_url":"https://api.github.com/users/facontidavide/followers","following_url":"https://api.github.com/users/facontidavide/following{/other_user}","gists_url":"https://api.github.com/users/facontidavide/gists{/gist_id}","starred_url":"https://api.github.com/users/facontidavide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facontidavide/subscriptions","organizations_url":"https://api.github.com/users/facontidavide/orgs","repos_url":"https://api.github.com/users/facontidavide/repos","events_url":"https://api.github.com/users/facontidavide/events{/privacy}","received_events_url":"https://api.github.com/users/facontidavide/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/facontidavide/spdlog","description":"Super fast C++ logging library.","fork":true,"url":"https://api.github.com/repos/facontidavide/spdlog","forks_url":"https://api.github.com/repos/facontidavide/spdlog/forks","keys_url":"https://api.github.com/repos/facontidavide/spdlog/keys{/key_id}","collaborators_url":"https://api.github.com/repos/facontidavide/spdlog/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/facontidavide/spdlog/teams","hooks_url":"https://api.github.com/repos/facontidavide/spdlog/hooks","issue_events_url":"https://api.github.com/repos/facontidavide/spdlog/issues/events{/number}","events_url":"https://api.github.com/repos/facontidavide/spdlog/events","assignees_url":"https://api.github.com/repos/facontidavide/spdlog/assignees{/user}","branches_url":"https://api.github.com/repos/facontidavide/spdlog/branches{/branch}","tags_url":"https://api.github.com/repos/facontidavide/spdlog/tags","blobs_url":"https://api.github.com/repos/facontidavide/spdlog/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/facontidavide/spdlog/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/facontidavide/spdlog/git/refs{/sha}","trees_url":"https://api.github.com/repos/facontidavide/spdlog/git/trees{/sha}","statuses_url":"https://api.github.com/repos/facontidavide/spdlog/statuses/{sha}","languages_url":"https://api.github.com/repos/facontidavide/spdlog/languages","stargazers_url":"https://api.github.com/repos/facontidavide/spdlog/stargazers","contributors_url":"https://api.github.com/repos/facontidavide/spdlog/contributors","subscribers_url":"https://api.github.com/repos/facontidavide/spdlog/subscribers","subscription_url":"https://api.github.com/repos/facontidavide/spdlog/subscription","commits_url":"https://api.github.com/repos/facontidavide/spdlog/commits{/sha}","git_commits_url":"https://api.github.com/repos/facontidavide/spdlog/git/commits{/sha}","comments_url":"https://api.github.com/repos/facontidavide/spdlog/comments{/number}","issue_comment_url":"https://api.github.com/repos/facontidavide/spdlog/issues/comments{/number}","contents_url":"https://api.github.com/repos/facontidavide/spdlog/contents/{+path}","compare_url":"https://api.github.com/repos/facontidavide/spdlog/compare/{base}...{head}","merges_url":"https://api.github.com/repos/facontidavide/spdlog/merges","archive_url":"https://api.github.com/repos/facontidavide/spdlog/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/facontidavide/spdlog/downloads","issues_url":"https://api.github.com/repos/facontidavide/spdlog/issues{/number}","pulls_url":"https://api.github.com/repos/facontidavide/spdlog/pulls{/number}","milestones_url":"https://api.github.com/repos/facontidavide/spdlog/milestones{/number}","notifications_url":"https://api.github.com/repos/facontidavide/spdlog/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/facontidavide/spdlog/labels{/name}","releases_url":"https://api.github.com/repos/facontidavide/spdlog/releases{/id}","deployments_url":"https://api.github.com/repos/facontidavide/spdlog/deployments","created_at":"2016-09-09T16:46:28Z","updated_at":"2016-09-09T16:46:29Z","pushed_at":"2016-09-14T21:53:47Z","git_url":"git://github.com/facontidavide/spdlog.git","ssh_url":"git@github.com:facontidavide/spdlog.git","clone_url":"https://github.com/facontidavide/spdlog.git","svn_url":"https://github.com/facontidavide/spdlog","homepage":"","size":2634,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"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":"master"}},"base":{"label":"gabime:master","ref":"master","sha":"c69df8ae444fd097209bb6c2e8816ff34bdc0d2c","user":{"login":"gabime","id":6052198,"avatar_url":"https://avatars.githubusercontent.com/u/6052198?v=3","gravatar_id":"","url":"https://api.github.com/users/gabime","html_url":"https://github.com/gabime","followers_url":"https://api.github.com/users/gabime/followers","following_url":"https://api.github.com/users/gabime/following{/other_user}","gists_url":"https://api.github.com/users/gabime/gists{/gist_id}","starred_url":"https://api.github.com/users/gabime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabime/subscriptions","organizations_url":"https://api.github.com/users/gabime/orgs","repos_url":"https://api.github.com/users/gabime/repos","events_url":"https://api.github.com/users/gabime/events{/privacy}","received_events_url":"https://api.github.com/users/gabime/received_events","type":"User","site_admin":false},"repo":{"id":26038648,"name":"spdlog","full_name":"gabime/spdlog","owner":{"login":"gabime","id":6052198,"avatar_url":"https://avatars.githubusercontent.com/u/6052198?v=3","gravatar_id":"","url":"https://api.github.com/users/gabime","html_url":"https://github.com/gabime","followers_url":"https://api.github.com/users/gabime/followers","following_url":"https://api.github.com/users/gabime/following{/other_user}","gists_url":"https://api.github.com/users/gabime/gists{/gist_id}","starred_url":"https://api.github.com/users/gabime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabime/subscriptions","organizations_url":"https://api.github.com/users/gabime/orgs","repos_url":"https://api.github.com/users/gabime/repos","events_url":"https://api.github.com/users/gabime/events{/privacy}","received_events_url":"https://api.github.com/users/gabime/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gabime/spdlog","description":"Super fast C++ logging library.","fork":false,"url":"https://api.github.com/repos/gabime/spdlog","forks_url":"https://api.github.com/repos/gabime/spdlog/forks","keys_url":"https://api.github.com/repos/gabime/spdlog/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gabime/spdlog/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gabime/spdlog/teams","hooks_url":"https://api.github.com/repos/gabime/spdlog/hooks","issue_events_url":"https://api.github.com/repos/gabime/spdlog/issues/events{/number}","events_url":"https://api.github.com/repos/gabime/spdlog/events","assignees_url":"https://api.github.com/repos/gabime/spdlog/assignees{/user}","branches_url":"https://api.github.com/repos/gabime/spdlog/branches{/branch}","tags_url":"https://api.github.com/repos/gabime/spdlog/tags","blobs_url":"https://api.github.com/repos/gabime/spdlog/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gabime/spdlog/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gabime/spdlog/git/refs{/sha}","trees_url":"https://api.github.com/repos/gabime/spdlog/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gabime/spdlog/statuses/{sha}","languages_url":"https://api.github.com/repos/gabime/spdlog/languages","stargazers_url":"https://api.github.com/repos/gabime/spdlog/stargazers","contributors_url":"https://api.github.com/repos/gabime/spdlog/contributors","subscribers_url":"https://api.github.com/repos/gabime/spdlog/subscribers","subscription_url":"https://api.github.com/repos/gabime/spdlog/subscription","commits_url":"https://api.github.com/repos/gabime/spdlog/commits{/sha}","git_commits_url":"https://api.github.com/repos/gabime/spdlog/git/commits{/sha}","comments_url":"https://api.github.com/repos/gabime/spdlog/comments{/number}","issue_comment_url":"https://api.github.com/repos/gabime/spdlog/issues/comments{/number}","contents_url":"https://api.github.com/repos/gabime/spdlog/contents/{+path}","compare_url":"https://api.github.com/repos/gabime/spdlog/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gabime/spdlog/merges","archive_url":"https://api.github.com/repos/gabime/spdlog/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gabime/spdlog/downloads","issues_url":"https://api.github.com/repos/gabime/spdlog/issues{/number}","pulls_url":"https://api.github.com/repos/gabime/spdlog/pulls{/number}","milestones_url":"https://api.github.com/repos/gabime/spdlog/milestones{/number}","notifications_url":"https://api.github.com/repos/gabime/spdlog/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gabime/spdlog/labels{/name}","releases_url":"https://api.github.com/repos/gabime/spdlog/releases{/id}","deployments_url":"https://api.github.com/repos/gabime/spdlog/deployments","created_at":"2014-11-01T01:28:53Z","updated_at":"2016-09-15T08:35:45Z","pushed_at":"2016-09-14T21:38:32Z","git_url":"git://github.com/gabime/spdlog.git","ssh_url":"git@github.com:gabime/spdlog.git","clone_url":"https://github.com/gabime/spdlog.git","svn_url":"https://github.com/gabime/spdlog","homepage":"","size":3205,"stargazers_count":1430,"watchers_count":1430,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":325,"mirror_url":null,"open_issues_count":16,"forks":325,"open_issues":16,"watchers":1430,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gabime/spdlog/pulls/278"},"html":{"href":"https://github.com/gabime/spdlog/pull/278"},"issue":{"href":"https://api.github.com/repos/gabime/spdlog/issues/278"},"comments":{"href":"https://api.github.com/repos/gabime/spdlog/issues/278/comments"},"review_comments":{"href":"https://api.github.com/repos/gabime/spdlog/pulls/278/comments"},"review_comment":{"href":"https://api.github.com/repos/gabime/spdlog/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gabime/spdlog/pulls/278/commits"},"statuses":{"href":"https://api.github.com/repos/gabime/spdlog/statuses/977415361293f7d9442bd216a495989162a2f13e"}}}}
{"actor":{"display_login":"facontidavide"}}