Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
cb5235eb
Commit
cb5235eb
authored
Sep 19, 2017
by
Mark
Committed by
Felix Lange
Sep 19, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
miner: make starting of CPU agent more reliable (#15148)
parent
a92d8a26
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
+12
-11
agent.go
miner/agent.go
+12
-11
No files found.
miner/agent.go
View file @
cb5235eb
...
...
@@ -53,7 +53,19 @@ func (self *CpuAgent) Work() chan<- *Work { return self.workCh }
func
(
self
*
CpuAgent
)
SetReturnCh
(
ch
chan
<-
*
Result
)
{
self
.
returnCh
=
ch
}
func
(
self
*
CpuAgent
)
Stop
()
{
if
!
atomic
.
CompareAndSwapInt32
(
&
self
.
isMining
,
1
,
0
)
{
return
// agent already stopped
}
self
.
stop
<-
struct
{}{}
done
:
// Empty work channel
for
{
select
{
case
<-
self
.
workCh
:
default
:
break
done
}
}
}
func
(
self
*
CpuAgent
)
Start
()
{
...
...
@@ -85,17 +97,6 @@ out:
break
out
}
}
done
:
// Empty work channel
for
{
select
{
case
<-
self
.
workCh
:
default
:
break
done
}
}
atomic
.
StoreInt32
(
&
self
.
isMining
,
0
)
}
func
(
self
*
CpuAgent
)
mine
(
work
*
Work
,
stop
<-
chan
struct
{})
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment