Skip to content

Commit

Permalink
Ensure that symmetric difference is locked. (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
deckarep authored Dec 13, 2016
1 parent 58ba19e commit 0c62f01
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
language: go

go:
- 1.5
- 1.6
- 1.7
- tip
Expand Down
8 changes: 7 additions & 1 deletion threadsafe.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,14 @@ func (set *threadSafeSet) Difference(other Set) Set {
func (set *threadSafeSet) SymmetricDifference(other Set) Set {
o := other.(*threadSafeSet)

set.RLock()
o.RLock()

unsafeDifference := set.s.SymmetricDifference(&o.s).(*threadUnsafeSet)
return &threadSafeSet{s: *unsafeDifference}
ret := &threadSafeSet{s: *unsafeDifference}
set.RUnlock()
o.RUnlock()
return ret
}

func (set *threadSafeSet) Clear() {
Expand Down

0 comments on commit 0c62f01

Please sign in to comment.