docs: Update thread communication docs

This commit is contained in:
Stein Magnus Jodal 2010-03-20 02:09:20 +01:00
parent e4feb863bb
commit 8a1d6ca228
3 changed files with 44 additions and 38 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

@ -1,37 +1,37 @@
Script for use with www.websequencediagrams.com Script for use with www.websequencediagrams.com
=============================================== ===============================================
Main -> NadMixer: start Main -> Core: create
activate NadMixer activate Core
note over NadMixer: calibrate device note over Core: create NadMixer
NadMixer -> Main: ready Core -> NadTalker: create
Main -> MpdHandler/Backend: start activate NadTalker
activate MpdHandler/Backend note over NadTalker: calibrate device
MpdHandler/Backend -> despotify: connect to Spotify note over Core: create DespotifyBackend
Core -> despotify: connect to Spotify
activate despotify activate despotify
MpdHandler/Backend -> Main: ready note over Core: create MpdFrontend
Main -> MpdServer/MpdSession: start Main -> Server: create
activate MpdServer/MpdSession activate Server
note over MpdServer/MpdSession: open port note over Server: open port
MpdServer/MpdSession -> Main: ready Client -> Server: connect
Client -> MpdServer/MpdSession: connect note over Server: open session
note over MpdServer/MpdSession: open session Client -> Server: play 1
Client -> MpdServer/MpdSession: play 1 Server -> Core: play 1
MpdServer/MpdSession -> MpdHandler/Backend: play 1 Core -> despotify: play first track
MpdHandler/Backend -> despotify: play first track Client -> Server: setvol 50
Client -> MpdServer/MpdSession: setvol 50 Server -> Core: setvol 50
MpdServer/MpdSession -> MpdHandler/Backend: setvol 50 Core -> NadTalker: volume = 50
MpdHandler/Backend -> NadMixer: volume = 50 Client -> Server: status
Client -> MpdServer/MpdSession: status Server -> Core: status
MpdServer/MpdSession -> MpdHandler/Backend: status Core -> NadTalker: volume?
MpdHandler/Backend -> NadMixer: volume? NadTalker -> Core: volume = 50
NadMixer -> MpdHandler/Backend: volume = 50 Core -> Server: status response
MpdHandler/Backend -> MpdServer/MpdSession: status response Server -> Client: status response
MpdServer/MpdSession -> Client: status response despotify -> Core: end of track callback
despotify -> MpdHandler/Backend: end of track callback Core -> despotify: play second track
MpdHandler/Backend -> despotify: play second track Client -> Server: stop
Client -> MpdServer/MpdSession: stop Server -> Core: stop
MpdServer/MpdSession -> MpdHandler/Backend: stop Core -> despotify: stop
MpdHandler/Backend -> despotify: stop Client -> Server: disconnect
Client -> MpdServer/MpdSession: disconnect note over Server: close session
note over MpdServer/MpdSession: close session

View File

@ -43,11 +43,17 @@ not Mopidy. The red nodes lives in the ``main`` process (running an
"AlsaMixer" -> "alsaaudio" [ label="use Python library" ] "AlsaMixer" -> "alsaaudio" [ label="use Python library" ]
Thread communication Thread/process communication
==================== ============================
.. warning:: - Everything starts with ``Main``.
- ``Main`` creates a ``Core`` process which runs the frontend, backend, and
This is a plan, and does not necessarily reflect what has been implemented. 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 .. image:: /_static/thread_communication.png