[lxc-devel] [lxc/lxc] 328a3f: commands: remove mutex from state client list

GitHub noreply at github.com
Mon Feb 26 15:34:58 UTC 2018


  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: 328a3f0f8b34ca11f5b1b6c9bcb3e40a15303255
      https://github.com/lxc/lxc/commit/328a3f0f8b34ca11f5b1b6c9bcb3e40a15303255
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2018-02-26 (Mon, 26 Feb 2018)

  Changed paths:
    M src/lxc/commands.c
    M src/lxc/commands_utils.c
    M src/lxc/start.c

  Log Message:
  -----------
  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 at ubuntu.com>


  Commit: d5bd4f0a1b9550aef14859448d7fecfaa3cecdb3
      https://github.com/lxc/lxc/commit/d5bd4f0a1b9550aef14859448d7fecfaa3cecdb3
  Author: Stéphane Graber <stgraber at stgraber.org>
  Date:   2018-02-26 (Mon, 26 Feb 2018)

  Changed paths:
    M src/lxc/commands.c
    M src/lxc/commands_utils.c
    M src/lxc/start.c

  Log Message:
  -----------
  Merge pull request #2189 from brauner/2018-02-16/remove_needless_locking

commands: remove mutex from state client list


Compare: https://github.com/lxc/lxc/compare/521c807906ea...d5bd4f0a1b95


More information about the lxc-devel mailing list