Hi folks,

We have finally managed to exorcise the fslock from the codebase. Both 1.25 and master no longer refer to it at all. We need to remove it from the juju/utils package to make sure that people don't accidentally try and use it again.

There is a new replacement, the juju/mutex package. To acquire a mutex, you create a mutex.Spec structure. You must at least provide a name, delay and clock. The delay is how long the code waits between tries to acquire the mutex. Named mutexs are shared between processes on the same machine. If a process holds the mutex and the process dies, the mutex is automatically released. A spec can also have a timeout value, and/or an abort channel.

On linux this is implemented with abstract domain sockets, on windows it uses a named semaphore, and on other platforms a flock is used on a named temp file.

https://godoc.org/github.com/juju/mutex

Cheers,
Tim

--
Juju-dev mailing list
Juju-dev@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju-dev

Reply via email to