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
e3a08875
Commit
e3a08875
authored
May 09, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
miner: start/stop mutex locked. Closes #887
parent
a7705fc2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
worker.go
miner/worker.go
+9
-0
No files found.
miner/worker.go
View file @
e3a08875
...
...
@@ -125,6 +125,9 @@ func (self *worker) pendingBlock() *types.Block {
}
func
(
self
*
worker
)
start
()
{
self
.
mu
.
Lock
()
defer
self
.
mu
.
Unlock
()
// spin up agents
for
_
,
agent
:=
range
self
.
agents
{
agent
.
Start
()
...
...
@@ -134,6 +137,9 @@ func (self *worker) start() {
}
func
(
self
*
worker
)
stop
()
{
self
.
mu
.
Lock
()
defer
self
.
mu
.
Unlock
()
if
atomic
.
LoadInt32
(
&
self
.
mining
)
==
1
{
// stop all agents
for
_
,
agent
:=
range
self
.
agents
{
...
...
@@ -146,6 +152,9 @@ func (self *worker) stop() {
}
func
(
self
*
worker
)
register
(
agent
Agent
)
{
self
.
mu
.
Lock
()
defer
self
.
mu
.
Unlock
()
self
.
agents
=
append
(
self
.
agents
,
agent
)
agent
.
SetReturnCh
(
self
.
recv
)
}
...
...
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