()
| 20 | } |
| 21 | |
| 22 | func (this *Locker) TryLock() (ok bool, err error) { |
| 23 | if this.fp == nil { |
| 24 | fp, err := os.OpenFile(this.path, os.O_CREATE|os.O_WRONLY, 0666) |
| 25 | if err != nil { |
| 26 | return false, err |
| 27 | } |
| 28 | this.fp = fp |
| 29 | } |
| 30 | return this.tryLock() |
| 31 | } |
| 32 | |
| 33 | func (this *Locker) Lock() error { |
| 34 | if this.fp == nil { |