]> git.ipfire.org Git - thirdparty/lxc.git/commit
commands: remove mutex from state client list 2189/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Mon, 26 Feb 2018 10:43:42 +0000 (11:43 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 26 Feb 2018 10:43:42 +0000 (11:43 +0100)
commit328a3f0f8b34ca11f5b1b6c9bcb3e40a15303255
tree24785b220000f204b8c791139c41d4d61c6fda2a
parent69556eaf83505502c479a55393d03312da1af377
commands: remove mutex from state client list

I was thinking about the locking here yesterday and it dawned on me that we
actually don't need this at all:
- possible contention between traversing list to send states to state clients
  and adding new state clients to the list:
  It is the command handler that adds new state clients to the state client
  list. The command handler and the code that actually sends out the container
  states run in the same process so there's not contention and thus no locking
  needed.
- adding state clients to the list from multiple threads:
  The command handler itself is single-threaded so only one thread's request can
  be served at the same time so no locking is needed.
- sending out the state to state clients via the command handler itself:
  The state client also adds and removes state clients from the state client
  list so there's no locking needed.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/commands.c
src/lxc/commands_utils.c
src/lxc/start.c