{"action":"created","issue":{"url":"https://api.github.com/repos/bitcoin/bitcoin/issues/9289","repository_url":"https://api.github.com/repos/bitcoin/bitcoin","labels_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/9289/labels{/name}","comments_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/9289/comments","events_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/9289/events","html_url":"https://github.com/bitcoin/bitcoin/pull/9289","id":193670934,"number":9289,"title":"net: drop boost::thread_group","user":{"login":"theuni","id":417043,"avatar_url":"https://avatars.githubusercontent.com/u/417043?v=3","gravatar_id":"","url":"https://api.github.com/users/theuni","html_url":"https://github.com/theuni","followers_url":"https://api.github.com/users/theuni/followers","following_url":"https://api.github.com/users/theuni/following{/other_user}","gists_url":"https://api.github.com/users/theuni/gists{/gist_id}","starred_url":"https://api.github.com/users/theuni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theuni/subscriptions","organizations_url":"https://api.github.com/users/theuni/orgs","repos_url":"https://api.github.com/users/theuni/repos","events_url":"https://api.github.com/users/theuni/events{/privacy}","received_events_url":"https://api.github.com/users/theuni/received_events","type":"User","site_admin":false},"labels":[{"id":135961,"url":"https://api.github.com/repos/bitcoin/bitcoin/labels/Refactoring","name":"Refactoring","color":"E6F6D6","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":15,"created_at":"2016-12-06T03:02:13Z","updated_at":"2016-12-22T07:19:56Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/9289","html_url":"https://github.com/bitcoin/bitcoin/pull/9289","diff_url":"https://github.com/bitcoin/bitcoin/pull/9289.diff","patch_url":"https://github.com/bitcoin/bitcoin/pull/9289.patch"},"body":"(Split out and rewritten chunk of #8631. I'll rebase that on top of this post-merge and reopen.)\r\n\r\nThis is a prerequisite for async network handling. As-is, we don't have enough control over the shutdown process to be able to deal with async connecting and send/recv.\r\n\r\nIn particular, we need to be sure that message processing has shut down before forcing all networking down, otherwise we run the risk of trying to process a node's messages during its destruction. This is not a problem now because the current sync model works fine with all threads being interrupted at the same time.\r\n\r\nAnd if that's not a satisfactory reason for the change, it also gets rid of a nice chunk of boost threading (and simplifies the rebase of #8631 :)\r\n\r\nTo accomplish this, we need to:\r\n- Set a flag to interrupt all net threads\r\n- notify all blocked condvars\r\n- replace MilliSleep (since they're boost interruption points)\r\n- teach init to Interrupt/Stop, similar to some of the other subsystems.\r\n\r\nThe MilliSleeps are replaced with condvars that check for the thread's interrupt flag. Since the flags are atomic, there's no need for real locking, so these condvars use a dummy CNullLock.\r\n\r\nWith all of that done, we may as well switch away from boost threads, since we're no longer dependent on interruption.\r\n\r\n@TheBlueMatt 3f3f0b4bce0fb34e803b4893594b44df1f2effe3 is the awkward change I mentioned on IRC. The global will be cleaned up when we move processing into a class as a next step (something like https://github.com/theuni/bitcoin/commit/3f598dbe7100c7c6c7bfb7e10210585327ed9d31)"},"comment":{"url":"https://api.github.com/repos/bitcoin/bitcoin/issues/comments/268735467","html_url":"https://github.com/bitcoin/bitcoin/pull/9289#issuecomment-268735467","issue_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/9289","id":268735467,"user":{"login":"theuni","id":417043,"avatar_url":"https://avatars.githubusercontent.com/u/417043?v=3","gravatar_id":"","url":"https://api.github.com/users/theuni","html_url":"https://github.com/theuni","followers_url":"https://api.github.com/users/theuni/followers","following_url":"https://api.github.com/users/theuni/following{/other_user}","gists_url":"https://api.github.com/users/theuni/gists{/gist_id}","starred_url":"https://api.github.com/users/theuni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theuni/subscriptions","organizations_url":"https://api.github.com/users/theuni/orgs","repos_url":"https://api.github.com/users/theuni/repos","events_url":"https://api.github.com/users/theuni/events{/privacy}","received_events_url":"https://api.github.com/users/theuni/received_events","type":"User","site_admin":false},"created_at":"2016-12-22T07:19:55Z","updated_at":"2016-12-22T07:19:55Z","body":"@TheBlueMatt I pushed up a new attempt to  https://github.com/theuni/bitcoin/commits/connman-threads-redo. I think you'll like that much better.\r\n\r\nI need to split a few non-obvious things into different commits, but mind having a quick look at the concept?\r\n\r\nI borrowed @JeremyRubin's wrapper idea but implemented it a bit differently: https://github.com/theuni/bitcoin/commit/7b4d8f608cca17fba7311c310e74c4cbd7671b73#diff-09404f8fdd1f69609d329cb0b1f1252e\r\n\r\nThe usage is (imo) pretty straightforward: https://github.com/theuni/bitcoin/commit/7b4d8f608cca17fba7311c310e74c4cbd7671b73#diff-09404f8fdd1f69609d329cb0b1f1252e"}}
{"actor":{"display_login":"theuni"}}