mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2025-02-23 09:13:15 +08:00
Style: use atomic CompareAndSwap (#151)
This commit is contained in:
parent
791d72e05b
commit
d1f6886558
@ -92,7 +92,7 @@ func (u *URLTest) fallback() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (u *URLTest) speedTest() {
|
func (u *URLTest) speedTest() {
|
||||||
if atomic.AddInt32(&u.once, 1) != 1 {
|
if atomic.CompareAndSwapInt32(&u.once, 0, 1) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer atomic.StoreInt32(&u.once, 0)
|
defer atomic.StoreInt32(&u.once, 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user