good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
c841e394
Commit
c841e394
authored
Oct 31, 2015
by
Jeffrey Wilcke
Browse files
Options
Downloads
Plain Diff
Merge pull request #1954 from obscuren/regression-miner
miner: synchronise start / stop
parents
016ad3e9
8c38f8d8
No related branches found
No related tags found
Loading
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
miner/remote_agent.go
+12
-5
12 additions, 5 deletions
miner/remote_agent.go
with
12 additions
and
5 deletions
miner/remote_agent.go
+
12
−
5
View file @
c841e394
...
...
@@ -20,6 +20,7 @@ import (
"errors"
"math/big"
"sync"
"sync/atomic"
"time"
"github.com/ethereum/ethash"
...
...
@@ -45,6 +46,8 @@ type RemoteAgent struct {
hashrateMu
sync
.
RWMutex
hashrate
map
[
common
.
Hash
]
hashrate
running
int32
// running indicates whether the agent is active. Call atomically
}
func
NewRemoteAgent
()
*
RemoteAgent
{
...
...
@@ -70,19 +73,23 @@ func (a *RemoteAgent) SetReturnCh(returnCh chan<- *Result) {
}
func
(
a
*
RemoteAgent
)
Start
()
{
if
!
atomic
.
CompareAndSwapInt32
(
&
a
.
running
,
0
,
1
)
{
return
}
a
.
quit
=
make
(
chan
struct
{})
a
.
workCh
=
make
(
chan
*
Work
,
1
)
go
a
.
maintainLoop
()
}
func
(
a
*
RemoteAgent
)
Stop
()
{
if
a
.
quit
!=
nil
{
close
(
a
.
quit
)
if
!
atomic
.
CompareAndSwapInt32
(
&
a
.
running
,
1
,
0
)
{
return
}
if
a
.
workCh
!=
nil
{
close
(
a
.
quit
)
close
(
a
.
workCh
)
}
}
// GetHashRate returns the accumulated hashrate of all identifier combined
func
(
a
*
RemoteAgent
)
GetHashRate
()
(
tot
int64
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment