{"action":"created","comment":{"url":"https://api.github.com/repos/NebulousLabs/Sia/pulls/comments/67595763","id":67595763,"diff_hunk":"@@ -20,8 +27,15 @@ func (m *Miner) threadedMine() {\n \t// occurring.\n \tcycleStart := time.Now()\n \tfor {\n-\t\t// Kill the thread if mining has been turned off.\n \t\tm.mu.Lock()\n+\t\t// Kill the thread if the miner's threadgroup is stopped.\n+\t\tif m.tg.IsStopped() {\n+\t\t\tm.miningOn = false\n+\t\t\tm.mining = false","path":"modules/miner/cpuminer.go","position":28,"original_position":28,"commit_id":"3f9e0b8d30db0ca6991780743eb282e6a6c50836","original_commit_id":"3f9e0b8d30db0ca6991780743eb282e6a6c50836","user":{"login":"VoidingWarranties","id":5420909,"avatar_url":"https://avatars.githubusercontent.com/u/5420909?v=3","gravatar_id":"","url":"https://api.github.com/users/VoidingWarranties","html_url":"https://github.com/VoidingWarranties","followers_url":"https://api.github.com/users/VoidingWarranties/followers","following_url":"https://api.github.com/users/VoidingWarranties/following{/other_user}","gists_url":"https://api.github.com/users/VoidingWarranties/gists{/gist_id}","starred_url":"https://api.github.com/users/VoidingWarranties/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VoidingWarranties/subscriptions","organizations_url":"https://api.github.com/users/VoidingWarranties/orgs","repos_url":"https://api.github.com/users/VoidingWarranties/repos","events_url":"https://api.github.com/users/VoidingWarranties/events{/privacy}","received_events_url":"https://api.github.com/users/VoidingWarranties/received_events","type":"User","site_admin":false},"body":"If we are in the process of closing setting these values to false shouldn't matter, right? Returning immediately would let you put the `IsStopped` check outside of the lock.","created_at":"2016-06-18T05:07:18Z","updated_at":"2016-06-18T05:07:18Z","html_url":"https://github.com/NebulousLabs/Sia/pull/1224#discussion_r67595763","pull_request_url":"https://api.github.com/repos/NebulousLabs/Sia/pulls/1224","_links":{"self":{"href":"https://api.github.com/repos/NebulousLabs/Sia/pulls/comments/67595763"},"html":{"href":"https://github.com/NebulousLabs/Sia/pull/1224#discussion_r67595763"},"pull_request":{"href":"https://api.github.com/repos/NebulousLabs/Sia/pulls/1224"}}},"pull_request":{"url":"https://api.github.com/repos/NebulousLabs/Sia/pulls/1224","id":72806020,"html_url":"https://github.com/NebulousLabs/Sia/pull/1224","diff_url":"https://github.com/NebulousLabs/Sia/pull/1224.diff","patch_url":"https://github.com/NebulousLabs/Sia/pull/1224.patch","issue_url":"https://api.github.com/repos/NebulousLabs/Sia/issues/1224","number":1224,"state":"open","locked":false,"title":"Clean shutdown of miner","user":{"login":"mnsl","id":14918275,"avatar_url":"https://avatars.githubusercontent.com/u/14918275?v=3","gravatar_id":"","url":"https://api.github.com/users/mnsl","html_url":"https://github.com/mnsl","followers_url":"https://api.github.com/users/mnsl/followers","following_url":"https://api.github.com/users/mnsl/following{/other_user}","gists_url":"https://api.github.com/users/mnsl/gists{/gist_id}","starred_url":"https://api.github.com/users/mnsl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mnsl/subscriptions","organizations_url":"https://api.github.com/users/mnsl/orgs","repos_url":"https://api.github.com/users/mnsl/repos","events_url":"https://api.github.com/users/mnsl/events{/privacy}","received_events_url":"https://api.github.com/users/mnsl/received_events","type":"User","site_admin":false},"body":"Adds `tg *siasync.ThreadGroup` field to the Miner type; m.tg.Stop() is called at the start of m.Close(), automatically unsubscribing the miner from its consensus set and transaction pool and blocking until the m.threadedMine() goroutine is done.\r\n\r\nTo unsubscribe the miner from the transaction pool, I've added an exported Unsubscribe method to TransactionPool (akin to the ConsensusSet Unsubscribe method).","created_at":"2016-06-07T02:10:39Z","updated_at":"2016-06-18T05:07:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"829a2e422a4ecf6f02aa049a164b9109d34fb867","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/NebulousLabs/Sia/pulls/1224/commits","review_comments_url":"https://api.github.com/repos/NebulousLabs/Sia/pulls/1224/comments","review_comment_url":"https://api.github.com/repos/NebulousLabs/Sia/pulls/comments{/number}","comments_url":"https://api.github.com/repos/NebulousLabs/Sia/issues/1224/comments","statuses_url":"https://api.github.com/repos/NebulousLabs/Sia/statuses/3f9e0b8d30db0ca6991780743eb282e6a6c50836","head":{"label":"mnsl:minershutdown","ref":"minershutdown","sha":"3f9e0b8d30db0ca6991780743eb282e6a6c50836","user":{"login":"mnsl","id":14918275,"avatar_url":"https://avatars.githubusercontent.com/u/14918275?v=3","gravatar_id":"","url":"https://api.github.com/users/mnsl","html_url":"https://github.com/mnsl","followers_url":"https://api.github.com/users/mnsl/followers","following_url":"https://api.github.com/users/mnsl/following{/other_user}","gists_url":"https://api.github.com/users/mnsl/gists{/gist_id}","starred_url":"https://api.github.com/users/mnsl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mnsl/subscriptions","organizations_url":"https://api.github.com/users/mnsl/orgs","repos_url":"https://api.github.com/users/mnsl/repos","events_url":"https://api.github.com/users/mnsl/events{/privacy}","received_events_url":"https://api.github.com/users/mnsl/received_events","type":"User","site_admin":false},"repo":{"id":56559741,"name":"Sia","full_name":"mnsl/Sia","owner":{"login":"mnsl","id":14918275,"avatar_url":"https://avatars.githubusercontent.com/u/14918275?v=3","gravatar_id":"","url":"https://api.github.com/users/mnsl","html_url":"https://github.com/mnsl","followers_url":"https://api.github.com/users/mnsl/followers","following_url":"https://api.github.com/users/mnsl/following{/other_user}","gists_url":"https://api.github.com/users/mnsl/gists{/gist_id}","starred_url":"https://api.github.com/users/mnsl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mnsl/subscriptions","organizations_url":"https://api.github.com/users/mnsl/orgs","repos_url":"https://api.github.com/users/mnsl/repos","events_url":"https://api.github.com/users/mnsl/events{/privacy}","received_events_url":"https://api.github.com/users/mnsl/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mnsl/Sia","description":"Blockchain-based marketplace for file storage","fork":true,"url":"https://api.github.com/repos/mnsl/Sia","forks_url":"https://api.github.com/repos/mnsl/Sia/forks","keys_url":"https://api.github.com/repos/mnsl/Sia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mnsl/Sia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mnsl/Sia/teams","hooks_url":"https://api.github.com/repos/mnsl/Sia/hooks","issue_events_url":"https://api.github.com/repos/mnsl/Sia/issues/events{/number}","events_url":"https://api.github.com/repos/mnsl/Sia/events","assignees_url":"https://api.github.com/repos/mnsl/Sia/assignees{/user}","branches_url":"https://api.github.com/repos/mnsl/Sia/branches{/branch}","tags_url":"https://api.github.com/repos/mnsl/Sia/tags","blobs_url":"https://api.github.com/repos/mnsl/Sia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mnsl/Sia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mnsl/Sia/git/refs{/sha}","trees_url":"https://api.github.com/repos/mnsl/Sia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mnsl/Sia/statuses/{sha}","languages_url":"https://api.github.com/repos/mnsl/Sia/languages","stargazers_url":"https://api.github.com/repos/mnsl/Sia/stargazers","contributors_url":"https://api.github.com/repos/mnsl/Sia/contributors","subscribers_url":"https://api.github.com/repos/mnsl/Sia/subscribers","subscription_url":"https://api.github.com/repos/mnsl/Sia/subscription","commits_url":"https://api.github.com/repos/mnsl/Sia/commits{/sha}","git_commits_url":"https://api.github.com/repos/mnsl/Sia/git/commits{/sha}","comments_url":"https://api.github.com/repos/mnsl/Sia/comments{/number}","issue_comment_url":"https://api.github.com/repos/mnsl/Sia/issues/comments{/number}","contents_url":"https://api.github.com/repos/mnsl/Sia/contents/{+path}","compare_url":"https://api.github.com/repos/mnsl/Sia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mnsl/Sia/merges","archive_url":"https://api.github.com/repos/mnsl/Sia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mnsl/Sia/downloads","issues_url":"https://api.github.com/repos/mnsl/Sia/issues{/number}","pulls_url":"https://api.github.com/repos/mnsl/Sia/pulls{/number}","milestones_url":"https://api.github.com/repos/mnsl/Sia/milestones{/number}","notifications_url":"https://api.github.com/repos/mnsl/Sia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mnsl/Sia/labels{/name}","releases_url":"https://api.github.com/repos/mnsl/Sia/releases{/id}","deployments_url":"https://api.github.com/repos/mnsl/Sia/deployments","created_at":"2016-04-19T02:56:00Z","updated_at":"2016-04-19T02:56:03Z","pushed_at":"2016-06-18T04:53:20Z","git_url":"git://github.com/mnsl/Sia.git","ssh_url":"git@github.com:mnsl/Sia.git","clone_url":"https://github.com/mnsl/Sia.git","svn_url":"https://github.com/mnsl/Sia","homepage":"https://sia.tech","size":8008,"stargazers_count":0,"watchers_count":0,"language":"Go","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":"NebulousLabs:master","ref":"master","sha":"3d7a7af6d9451420b11d12d274fb25b1a02ccbf1","user":{"login":"NebulousLabs","id":7471422,"avatar_url":"https://avatars.githubusercontent.com/u/7471422?v=3","gravatar_id":"","url":"https://api.github.com/users/NebulousLabs","html_url":"https://github.com/NebulousLabs","followers_url":"https://api.github.com/users/NebulousLabs/followers","following_url":"https://api.github.com/users/NebulousLabs/following{/other_user}","gists_url":"https://api.github.com/users/NebulousLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/NebulousLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NebulousLabs/subscriptions","organizations_url":"https://api.github.com/users/NebulousLabs/orgs","repos_url":"https://api.github.com/users/NebulousLabs/repos","events_url":"https://api.github.com/users/NebulousLabs/events{/privacy}","received_events_url":"https://api.github.com/users/NebulousLabs/received_events","type":"Organization","site_admin":false},"repo":{"id":25370072,"name":"Sia","full_name":"NebulousLabs/Sia","owner":{"login":"NebulousLabs","id":7471422,"avatar_url":"https://avatars.githubusercontent.com/u/7471422?v=3","gravatar_id":"","url":"https://api.github.com/users/NebulousLabs","html_url":"https://github.com/NebulousLabs","followers_url":"https://api.github.com/users/NebulousLabs/followers","following_url":"https://api.github.com/users/NebulousLabs/following{/other_user}","gists_url":"https://api.github.com/users/NebulousLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/NebulousLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NebulousLabs/subscriptions","organizations_url":"https://api.github.com/users/NebulousLabs/orgs","repos_url":"https://api.github.com/users/NebulousLabs/repos","events_url":"https://api.github.com/users/NebulousLabs/events{/privacy}","received_events_url":"https://api.github.com/users/NebulousLabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/NebulousLabs/Sia","description":"Blockchain-based marketplace for file storage","fork":false,"url":"https://api.github.com/repos/NebulousLabs/Sia","forks_url":"https://api.github.com/repos/NebulousLabs/Sia/forks","keys_url":"https://api.github.com/repos/NebulousLabs/Sia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NebulousLabs/Sia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NebulousLabs/Sia/teams","hooks_url":"https://api.github.com/repos/NebulousLabs/Sia/hooks","issue_events_url":"https://api.github.com/repos/NebulousLabs/Sia/issues/events{/number}","events_url":"https://api.github.com/repos/NebulousLabs/Sia/events","assignees_url":"https://api.github.com/repos/NebulousLabs/Sia/assignees{/user}","branches_url":"https://api.github.com/repos/NebulousLabs/Sia/branches{/branch}","tags_url":"https://api.github.com/repos/NebulousLabs/Sia/tags","blobs_url":"https://api.github.com/repos/NebulousLabs/Sia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NebulousLabs/Sia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NebulousLabs/Sia/git/refs{/sha}","trees_url":"https://api.github.com/repos/NebulousLabs/Sia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NebulousLabs/Sia/statuses/{sha}","languages_url":"https://api.github.com/repos/NebulousLabs/Sia/languages","stargazers_url":"https://api.github.com/repos/NebulousLabs/Sia/stargazers","contributors_url":"https://api.github.com/repos/NebulousLabs/Sia/contributors","subscribers_url":"https://api.github.com/repos/NebulousLabs/Sia/subscribers","subscription_url":"https://api.github.com/repos/NebulousLabs/Sia/subscription","commits_url":"https://api.github.com/repos/NebulousLabs/Sia/commits{/sha}","git_commits_url":"https://api.github.com/repos/NebulousLabs/Sia/git/commits{/sha}","comments_url":"https://api.github.com/repos/NebulousLabs/Sia/comments{/number}","issue_comment_url":"https://api.github.com/repos/NebulousLabs/Sia/issues/comments{/number}","contents_url":"https://api.github.com/repos/NebulousLabs/Sia/contents/{+path}","compare_url":"https://api.github.com/repos/NebulousLabs/Sia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NebulousLabs/Sia/merges","archive_url":"https://api.github.com/repos/NebulousLabs/Sia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NebulousLabs/Sia/downloads","issues_url":"https://api.github.com/repos/NebulousLabs/Sia/issues{/number}","pulls_url":"https://api.github.com/repos/NebulousLabs/Sia/pulls{/number}","milestones_url":"https://api.github.com/repos/NebulousLabs/Sia/milestones{/number}","notifications_url":"https://api.github.com/repos/NebulousLabs/Sia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NebulousLabs/Sia/labels{/name}","releases_url":"https://api.github.com/repos/NebulousLabs/Sia/releases{/id}","deployments_url":"https://api.github.com/repos/NebulousLabs/Sia/deployments","created_at":"2014-10-17T17:50:25Z","updated_at":"2016-06-17T05:59:07Z","pushed_at":"2016-06-18T05:02:19Z","git_url":"git://github.com/NebulousLabs/Sia.git","ssh_url":"git@github.com:NebulousLabs/Sia.git","clone_url":"https://github.com/NebulousLabs/Sia.git","svn_url":"https://github.com/NebulousLabs/Sia","homepage":"https://sia.tech","size":29066,"stargazers_count":243,"watchers_count":243,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":37,"mirror_url":null,"open_issues_count":79,"forks":37,"open_issues":79,"watchers":243,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/NebulousLabs/Sia/pulls/1224"},"html":{"href":"https://github.com/NebulousLabs/Sia/pull/1224"},"issue":{"href":"https://api.github.com/repos/NebulousLabs/Sia/issues/1224"},"comments":{"href":"https://api.github.com/repos/NebulousLabs/Sia/issues/1224/comments"},"review_comments":{"href":"https://api.github.com/repos/NebulousLabs/Sia/pulls/1224/comments"},"review_comment":{"href":"https://api.github.com/repos/NebulousLabs/Sia/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/NebulousLabs/Sia/pulls/1224/commits"},"statuses":{"href":"https://api.github.com/repos/NebulousLabs/Sia/statuses/3f9e0b8d30db0ca6991780743eb282e6a6c50836"}}}}
{"actor":{"display_login":"VoidingWarranties"}}