github.com/trufflesecurity/touchfile
Package touchfile provides a mechanism to create, lock, and manage a touch file for coordinating access between different processes. Mutexes are used to coordinate between goroutines. Touch files are used to coordinate between different processes. Because touch files aren't truly atomic, this package uses flock to acquire a voluntary lock on the file. This package creates a temporary file (unless otherwise specified) to use as a lock file. A voluntary lock is acquired on the file using the flock system call. WARNING: Like all go code related to concurrency, this module is NOT reentrant. And because go doesn't have a way to detect reentrancy, it's up to the caller to avoid deadlocks caused by concurrent access to this module. WARNING: Because flock is used, this module may not be compatible with all file systems (notably networked file systems like NFS). Example usage: Basic usage: Global lock using the program binary: Using WithLock for a critical section:
proxy.golang.org
v0.1.1
over 1 year ago
2
Links
| Registry | proxy.golang.org |
| Source | Repository |
| Docs | Documentation |
| JSON API | View JSON |
| CodeMeta | codemeta.json |
Package Details
| PURL |
pkg:golang/github.com/trufflesecurity/touchfile
spec |
| License | Apache-2.0 |
| Namespace | github.com/trufflesecurity |
| First Release | over 1 year ago |
| Last Synced | about 18 hours ago |