()
| 183 | } |
| 184 | |
| 185 | func (e *engine) start() { |
| 186 | e.mu.Lock() |
| 187 | defer e.mu.Unlock() |
| 188 | |
| 189 | if atomic.LoadInt32(&e.mining) == 0 { |
| 190 | // spin up workers |
| 191 | for worker := range e.workers { |
| 192 | worker.Start() |
| 193 | } |
| 194 | |
| 195 | go e.wait() |
| 196 | } |
| 197 | |
| 198 | atomic.StoreInt32(&e.mining, 1) |
| 199 | } |
| 200 | |
| 201 | func (e *engine) stop() { |
| 202 | e.mu.Lock() |