Source File
trylock.go
Belonging Package
github.com/pion/turn/v4/internal/client
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>// SPDX-License-Identifier: MITpackage clientimport ()// TryLock implement the classic "try-lock" operation.type TryLock struct {n int32}// Lock tries to lock the try-lock. If successful, it returns true.// Otherwise, it returns false immediately.func ( *TryLock) () error {if !atomic.CompareAndSwapInt32(&.n, 0, 1) {return errDoubleLock}return nil}// Unlock unlocks the try-lock.func ( *TryLock) () {atomic.StoreInt32(&.n, 0)}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |