The use of mutexes in byzcoin.Service got somehow out of hand.
This PR cleans up the use of 'Service.close' and 'Service.working' by
adding two new structures that do all the locking.
It also contains minimal changes to the tests to make them pass.
For review: can you please look at the two structures runSingleWG and tasksWG in byzcoin/struct.go and tell me if they look OK? It simplifies a lot the locking in the byzcoin.Service. I hope the tests are relevant ;)
I tried to think of how to merge the two
The use of mutexes in byzcoin.Service got somehow out of hand. This PR cleans up the use of 'Service.close' and 'Service.working' by adding two new structures that do all the locking. It also contains minimal changes to the tests to make them pass.
For review: can you please look at the two structures
runSingleWG
andtasksWG
inbyzcoin/struct.go
and tell me if they look OK? It simplifies a lot the locking in thebyzcoin.Service
. I hope the tests are relevant ;) I tried to think of how to merge the two