Fixed possible ConcurrentModificationException
This commit is contained in:
parent
1e605f56a5
commit
fb300c8731
@ -43,6 +43,10 @@ public class MultiThreadedPOWEngine implements ProofOfWorkEngine {
|
|||||||
for (int i = 0; i < cores; i++) {
|
for (int i = 0; i < cores; i++) {
|
||||||
Worker w = new Worker(workers, (byte) cores, i, initialHash, target);
|
Worker w = new Worker(workers, (byte) cores, i, initialHash, target);
|
||||||
workers.add(w);
|
workers.add(w);
|
||||||
|
}
|
||||||
|
for (Worker w : workers) {
|
||||||
|
// Doing this in the previous loop might cause a ConcurrentModificationException in the worker
|
||||||
|
// if a worker finds a nonce while new ones are still being added.
|
||||||
w.start();
|
w.start();
|
||||||
}
|
}
|
||||||
for (Worker w : workers) {
|
for (Worker w : workers) {
|
||||||
|
Loading…
Reference in New Issue
Block a user