*: use CompareAndSwap instead of CAS for atomics
go.uber.org/atomic deprecated CAS methods in version 1.10 (that introduced CompareAndSwap), so we need to fix it. Signed-off-by: Roman Khimov <roman@nspcc.ru>
This commit is contained in:
parent
2567c4c672
commit
0a160ee93b
9 changed files with 22 additions and 22 deletions
|
@ -153,7 +153,7 @@ func (bq *Queue) LastQueued() (uint32, int) {
|
|||
|
||||
// Discard stops the queue and prevents it from accepting more blocks to enqueue.
|
||||
func (bq *Queue) Discard() {
|
||||
if bq.discarded.CAS(false, true) {
|
||||
if bq.discarded.CompareAndSwap(false, true) {
|
||||
bq.queueLock.Lock()
|
||||
close(bq.checkBlocks)
|
||||
// Technically we could bq.queue = nil, but this would cost
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue