diff --git a/docs/_static/thread_communication.png b/docs/_static/thread_communication.png index 5703b104..95bf1892 100644 Binary files a/docs/_static/thread_communication.png and b/docs/_static/thread_communication.png differ diff --git a/docs/_static/thread_communication.txt b/docs/_static/thread_communication.txt index 66ed34e9..4119004e 100644 --- a/docs/_static/thread_communication.txt +++ b/docs/_static/thread_communication.txt @@ -1,37 +1,37 @@ Script for use with www.websequencediagrams.com =============================================== -Main -> NadMixer: start -activate NadMixer -note over NadMixer: calibrate device -NadMixer -> Main: ready -Main -> MpdHandler/Backend: start -activate MpdHandler/Backend -MpdHandler/Backend -> despotify: connect to Spotify +Main -> Core: create +activate Core +note over Core: create NadMixer +Core -> NadTalker: create +activate NadTalker +note over NadTalker: calibrate device +note over Core: create DespotifyBackend +Core -> despotify: connect to Spotify activate despotify -MpdHandler/Backend -> Main: ready -Main -> MpdServer/MpdSession: start -activate MpdServer/MpdSession -note over MpdServer/MpdSession: open port -MpdServer/MpdSession -> Main: ready -Client -> MpdServer/MpdSession: connect -note over MpdServer/MpdSession: open session -Client -> MpdServer/MpdSession: play 1 -MpdServer/MpdSession -> MpdHandler/Backend: play 1 -MpdHandler/Backend -> despotify: play first track -Client -> MpdServer/MpdSession: setvol 50 -MpdServer/MpdSession -> MpdHandler/Backend: setvol 50 -MpdHandler/Backend -> NadMixer: volume = 50 -Client -> MpdServer/MpdSession: status -MpdServer/MpdSession -> MpdHandler/Backend: status -MpdHandler/Backend -> NadMixer: volume? -NadMixer -> MpdHandler/Backend: volume = 50 -MpdHandler/Backend -> MpdServer/MpdSession: status response -MpdServer/MpdSession -> Client: status response -despotify -> MpdHandler/Backend: end of track callback -MpdHandler/Backend -> despotify: play second track -Client -> MpdServer/MpdSession: stop -MpdServer/MpdSession -> MpdHandler/Backend: stop -MpdHandler/Backend -> despotify: stop -Client -> MpdServer/MpdSession: disconnect -note over MpdServer/MpdSession: close session +note over Core: create MpdFrontend +Main -> Server: create +activate Server +note over Server: open port +Client -> Server: connect +note over Server: open session +Client -> Server: play 1 +Server -> Core: play 1 +Core -> despotify: play first track +Client -> Server: setvol 50 +Server -> Core: setvol 50 +Core -> NadTalker: volume = 50 +Client -> Server: status +Server -> Core: status +Core -> NadTalker: volume? +NadTalker -> Core: volume = 50 +Core -> Server: status response +Server -> Client: status response +despotify -> Core: end of track callback +Core -> despotify: play second track +Client -> Server: stop +Server -> Core: stop +Core -> despotify: stop +Client -> Server: disconnect +note over Server: close session diff --git a/docs/development/internals.rst b/docs/development/internals.rst index ca6edc8a..26aeb86d 100644 --- a/docs/development/internals.rst +++ b/docs/development/internals.rst @@ -43,11 +43,17 @@ not Mopidy. The red nodes lives in the ``main`` process (running an "AlsaMixer" -> "alsaaudio" [ label="use Python library" ] -Thread communication -==================== +Thread/process communication +============================ -.. warning:: - - This is a plan, and does not necessarily reflect what has been implemented. +- Everything starts with ``Main``. +- ``Main`` creates a ``Core`` process which runs the frontend, backend, and + mixer. +- Mixers *may* create an additional process for communication with external + devices, like ``NadTalker`` in this example. +- Backend libraries *may* have threads of their own, like ``despotify`` here + which has additional threads in the ``Core`` process. +- ``Server`` part currently runs in the same process and thread as ``Main``. +- ``Client`` is some external client talking to ``Server`` over a socket. .. image:: /_static/thread_communication.png