mirror of
https://gitee.com/johng/gf.git
synced 2024-12-05 05:37:55 +08:00
18 lines
271 B
Go
18 lines
271 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"gitee.com/johng/gf/third/github.com/theckman/go-flock"
|
|
"time"
|
|
)
|
|
|
|
func main() {
|
|
l := flock.NewFlock("/tmp/go-lock.lock")
|
|
l.Lock()
|
|
fmt.Printf("lock 1")
|
|
l.Lock()
|
|
fmt.Printf("lock 1")
|
|
|
|
time.Sleep(time.Hour)
|
|
}
|