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
===============================================
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

View File

@ -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