-
lxclock: Replace named sempahore with flock · df271a59Serge Hallyn authored
The problem: if a task is killed while holding a posix semaphore, there appears to be no way to have the semaphore be reliably autmoatically released. The only trick which seemed promising is to store the pid of the lock holder in some file and have later lock seekers check whether that task has died. Instead of going down that route, this patch switches from a named posix semaphore to flock. The advantage is that when the task is killed, its fds are closed and locks are automatically released. The disadvantage of flock is that we can't rely on it to exclude threads. Therefore c->slock must now always be wrapped inside c->privlock. This patch survived basic testing with the lxcapi_create patchset, where now killing lxc-create while it was holding the lock did not lock up future api commands. Signed-off-by:Serge Hallyn <serge.hallyn@ubuntu.com>
df271a59
| Name |
Last commit
|
Last update |
|---|---|---|
| .. | ||
| include | Loading commit data... | |
| lua-lxc | Loading commit data... | |
| lxc | Loading commit data... | |
| python-lxc | Loading commit data... | |
| tests | Loading commit data... | |
| Makefile.am | Loading commit data... |