]> git.ipfire.org Git - thirdparty/lxc.git/commit
commands: remove mutex from state client list
authorChristian Brauner <christian.brauner@ubuntu.com>
Mon, 26 Feb 2018 10:43:42 +0000 (11:43 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 23 Aug 2018 20:33:22 +0000 (22:33 +0200)
commitc5f35c3a2229528e2ab7e20c17065c093bc82a5c
treef7858c5848a130e39d033fbbfe1916143e46481b
parenta6123af191c048e7cc96e73b00e517347e82964d
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