【文件属性】:
文件名称:umutex:Golang解锁互斥锁
文件大小:2KB
文件格式:ZIP
更新时间:2021-05-15 17:43:00
Go
解除互斥锁
这个简单的程序包为那些不想编写很多select子句或不想被众多渠道弄糊涂的人提供了无阻塞的互斥锁。
使用范例
package main
import (
"fmt"
"github.com/yudai/umutex"
)
func main () {
// Create mutex
mutex := umutex . New ()
// First time, try should succeed
if mutex . TryLock () {
fmt . Println ( "SUCCESS" )
} else {
fmt . Println ( "FAILURE" )
}
// Second time, try should fail as it's locked
if mutex . TryLock () {
fmt . Println
【文件预览】:
umutex-master
----umutex_test.go(577B)
----LICENSE(1KB)
----umutex.go(913B)
----README.md(840B)