Make erasure Encode and Decode atomic to avoid races

This commit is contained in:
Harshavardhana
2015-10-06 22:17:52 -07:00
parent e6d935731a
commit ab5ea997ab
3 changed files with 13 additions and 28 deletions
+3
View File
@@ -38,6 +38,9 @@ import (
//
// "dataLen" is the length of original source data
func (e *Erasure) Decode(encodedDataBlocks [][]byte, dataLen int) (decodedData []byte, err error) {
e.mutex.Lock()
defer e.mutex.Unlock()
var source, target **C.uchar
k := int(e.params.K)