]> git.ipfire.org Git - thirdparty/lxc.git/commit
locking: update per Dwight's comment
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Fri, 24 May 2013 21:03:22 +0000 (16:03 -0500)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Sat, 25 May 2013 04:27:21 +0000 (23:27 -0500)
commit5cee8c5040661f9875bf41cfffd641c87afae8af
treec868075a8dd5a48df152a0fe38594fba3fa9dbd1
parentdf271a59cbfcfbe98fa4bd7af3ae595633539a12
locking: update per Dwight's comment

Create three pairs of functions:
int process_lock(void);
void process_unlock(void);
int container_mem_lock(struct lxc_container *c)
void container_mem_unlock(struct lxc_container *c)
int container_disk_lock(struct lxc_container *c);
void container_disk_unlock(struct lxc_container *c);

and use those in lxccontainer.c

process_lock() is to protect the process state among multiple threads.
container_mem_lock() is to protect a struct container among multiple
threads.  container_disk_lock is to protect a container on disk.

Also remove the lock in lxcapi_init_pid() as Dwight suggested.

Fix a typo (s/container/contain) spotted by Dwight.

More locking fixes are needed, but let's first the the fundamentals
right.  How close does this get us?

Changelog: v2:
fix lxclock compile

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Dwight Engen <dwight.engen@oracle.com>
src/lxc/lxccontainer.c
src/lxc/lxclock.c
src/lxc/lxclock.h