Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The LUCI Authors. All rights reserved. | |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | |
| 3 // that can be found in the LICENSE file. | |
| 4 | |
| 5 package lib | |
| 6 | |
| 7 import ( | |
| 8 "fmt" | |
| 9 "os" | |
| 10 ) | |
| 11 | |
| 12 // TODO(charliea): Add timeout parameter to this function. | |
| 13 func AcquireExclusiveLock(path string) error { | |
| 14 _, err := os.OpenFile(path, os.O_APPEND, 0666) | |
| 15 if os.IsNotExist(err) { | |
| 16 return fmt.Errorf("cannot acquire lock on %s because file does n ot exist", path) | |
|
iannucci
2017/07/12 01:34:59
recommend use of luci-go/common/errors (they colle
charliea (OOO until 10-5)
2017/07/12 02:17:17
Done.
| |
| 17 } | |
| 18 | |
| 19 panic("implement lock acquisition") | |
| 20 } | |
| OLD | NEW |