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 if _, err := os.Stat(path); os.IsNotExist(err) { | |
|
iannucci
2017/07/11 20:52:15
tbh, I would probably not stat, I'd just bail on E
charliea (OOO until 10-5)
2017/07/11 23:26:16
The actual lock implementation accepts an already-
| |
| 15 return fmt.Errorf("cannot acquire lock on %s because file does n ot exist", path) | |
| 16 } | |
| 17 | |
| 18 // TODO(charliea): Acquire the actual lock. | |
|
iannucci
2017/07/11 20:52:14
can also `panic("implement lock acquisition")`
charliea (OOO until 10-5)
2017/07/11 23:26:16
Done.
| |
| 19 return nil | |
| 20 } | |
| OLD | NEW |