Browse Source

Add BitArray.Update()

pull/1842/head
Jae Kwon 8 years ago
parent
commit
9dc4dc1960
1 changed files with 13 additions and 0 deletions
  1. +13
    -0
      bit_array.go

+ 13
- 0
bit_array.go View File

@ -302,3 +302,16 @@ func (bA *BitArray) Bytes() []byte {
}
return bytes
}
// NOTE: other bitarray o is not locked when reading,
// so if necessary, caller must copy or lock o prior to calling Update.
// If bA is nil, does nothing.
func (bA *BitArray) Update(o *BitArray) {
if bA == nil {
return
}
bA.mtx.Lock()
defer bA.mtx.Unlock()
copy(bA.Elems, o.Elems)
}

Loading…
Cancel
Save