Use chan struct{} for semaphores

With semaphores we don't actually care about the value passed in. It
makes sense to use a 0 bytes type in these cases.
There is also the added benefit of compiler optimisations for this
specific use case as described here:
https://docs.google.com/document/d/1yIAYmbvL3JxOKOjuCyon7JhW4cSv1wy5hC0ApeGMV9s/pub
This commit is contained in:
Tomás Senart 2014-07-02 18:00:47 +02:00
parent e29f40274d
commit 73ed07bd85

View file

@ -25,7 +25,7 @@ type txValidateItem struct {
// function that is intended to be in run multiple goroutines.
type txValidator struct {
validateChan chan *txValidateItem
quitChan chan bool
quitChan chan struct{}
resultChan chan error
txStore TxStore
flags btcscript.ScriptFlags
@ -181,7 +181,7 @@ func (v *txValidator) Validate(items []*txValidateItem) error {
func newTxValidator(txStore TxStore, flags btcscript.ScriptFlags) *txValidator {
return &txValidator{
validateChan: make(chan *txValidateItem),
quitChan: make(chan bool),
quitChan: make(chan struct{}),
resultChan: make(chan error),
txStore: txStore,
flags: flags,