add plantuml, dot files 14/174614/1
authorBoram Park <boram1288.park@samsung.com>
Tue, 3 Apr 2018 07:26:13 +0000 (16:26 +0900)
committerBoram Park <boram1288.park@samsung.com>
Tue, 3 Apr 2018 07:27:40 +0000 (16:27 +0900)
Change-Id: I99569149d5b46722426a97e8f59e39fa3db526bc

doc/tdm_header.txt [new file with mode: 0644]
doc/tdm_thread.txt [new file with mode: 0644]
doc/tdm_thread_deadlock.txt [new file with mode: 0644]

diff --git a/doc/tdm_header.txt b/doc/tdm_header.txt
new file mode 100644 (file)
index 0000000..59c3cef
--- /dev/null
@@ -0,0 +1,109 @@
+#dot -Tpng a.dot -o a.png
+
+digraph G
+{
+       compound=true;
+       nodesep=0.2;
+       ranksep=0.5;
+       node [fontname=Courier,fontsize=10,width=0,height=0,shape=box];
+
+       {
+               node [fontname=Courier,fontsize=10,shape=plaintext,color=white];
+               edge [style=invis];
+               Lv0 -> Lv1 -> Lv2 -> Lv3 -> Lv4 -> Lv5 -> Lv6;
+       }
+
+       {
+               rank=same;
+               Lv0;
+               "tdm_common.h";
+       }
+
+       {
+               rank=same;
+               Lv1;
+
+               "tdm_types.h";
+               "tdm_client_types.h";
+       }
+
+       {
+               rank=same;
+               Lv2;
+
+               "tdm_list.h";
+               "tdm_log.h";
+               "tdm_helper.h";
+               "tdm.h";
+               "tdm_backend.h";
+               "tdm_client.h";
+       }
+
+       {
+               rank=same;
+               Lv3;
+
+               "tdm_private_types.h";
+       }
+
+       {
+               rank=same;
+               Lv4;
+
+               "tdm_config.h";
+               "tdm_thread.h";
+       }
+
+
+       {
+               rank=same;
+               Lv5;
+
+               "tdm_macro.h";
+       }
+
+
+       {
+               rank=same;
+               Lv6;
+
+               "tdm_private.h";
+       }
+
+       "tdm_list.h" [style="filled",fillcolor=gold];
+       "tdm_log.h" [style="filled",fillcolor=gold];
+       "tdm_helper.h" [style="filled",fillcolor=gold];
+
+       "tdm_private.h" [style="filled",fillcolor=grey];
+       "tdm_private_types.h" [style="filled",fillcolor=grey];
+       "tdm_config.h" [style="filled",fillcolor=grey];
+       "tdm_macro.h" [style="filled",fillcolor=grey];
+       "tdm_thread.h" [style="filled",fillcolor=grey];
+
+       "tdm_backend.h" [style="filled",fillcolor=darkorchid1];
+       "tdm.h" [style="filled",fillcolor=cornflowerblue];
+
+       "tdm_client.h" [style="filled",fillcolor= skyblue];
+
+       "tdm_client_types.h" -> "tdm_common.h";
+       "tdm_client.h" -> "tdm_client_types.h";
+       "tdm_types.h" -> "tdm_common.h";
+       "tdm.h" -> "tdm_types.h";
+       "tdm_helper.h" -> "tdm_types.h";
+       "tdm_backend.h" -> "tdm_types.h";
+       "tdm_macro.h" -> "tdm_private_types.h";
+       "tdm_macro.h" -> "tdm_thread.h";
+       "tdm_thread.h" -> "tdm_private_types.h";
+       "tdm_private_types.h" -> "tdm_types.h";
+       "tdm_private_types.h" -> "tdm_list.h";
+       "tdm_private_types.h" -> "tdm_log.h";
+       "tdm_private_types.h" -> "tdm_backend.h";
+       "tdm_config.h" -> "tdm_private_types.h";
+       "tdm_private.h" -> "tdm_private_types.h";
+       "tdm_private.h" -> "tdm_macro.h";
+       "tdm_private.h" -> "tdm_helper.h";
+       "tdm_private.h" -> "tdm_config.h";
+       "tdm_private.h" -> "tdm_thread.h";
+
+       "tdm_private_types.h" -> "tdm.h";
+}
diff --git a/doc/tdm_thread.txt b/doc/tdm_thread.txt
new file mode 100644 (file)
index 0000000..5e6f28f
--- /dev/null
@@ -0,0 +1,40 @@
+@startuml\r
+\r
+hide footbox\r
+\r
+participant "E20 main thread" as main\r
+participant "tdm thread" as sub\r
+\r
+== an asynchronous event ==\r
+sub <-- : an asynchronous event\r
+activate sub\r
+       sub -> sub: calling thread callbacks in tdm-thread\r
+       activate sub\r
+       deactivate sub\r
+       main <-- sub: sending an asynchronous event\r
+deactivate sub\r
+activate main\r
+main -> main: calling thread callbacks in main-thread\r
+activate main\r
+deactivate main\r
+deactivate main\r
+\r
+== a synchronous event ==\r
+sub <-- : a synchronous event\r
+activate sub\r
+       sub -> sub: calling thread callbacks in tdm-thread\r
+       activate sub\r
+       deactivate sub\r
+       sub --> main: sending a synchronous event\r
+       activate main\r
+               sub -> sub: pthread_cond_wait\r
+               activate sub\r
+                       main -> main: calling thread callbacks in main-thread\r
+                       activate main\r
+                       deactivate main\r
+                       main --> sub: pthread_cond_signal\r
+               deactivate sub\r
+       deactivate main\r
+deactivate sub\r
+\r
+@enduml\r
diff --git a/doc/tdm_thread_deadlock.txt b/doc/tdm_thread_deadlock.txt
new file mode 100644 (file)
index 0000000..3a01697
--- /dev/null
@@ -0,0 +1,40 @@
+@startuml\r
+\r
+hide footbox\r
+\r
+participant "E20 main thread" as main\r
+participant "tdm thread" as sub\r
+\r
+sub <-- : a synchronous event\r
+activate sub\r
+--> main: a synchronous event\r
+activate main\r
+sub -> sub: calling thread callbacks in tdm-thread\r
+activate sub\r
+deactivate sub\r
+sub --> main: sending a synchronous event\r
+sub -> sub: pthread_cond_wait\r
+activate sub\r
+main -> main: calling thread callbacks in main-thread\r
+activate main\r
+deactivate main\r
+main --> sub: sending a synchronous event\r
+main -> main: pthread_cond_wait\r
+activate main\r
+deactivate sub\r
+deactivate main\r
+deactivate main\r
+deactivate sub\r
+\r
+... <color #red>(DEADLOCK)</color> ...\r
+note over main, sub\r
+       * 만약 main-thread, tdm-thread에서 동시에 synchronous event가 발생되게 되면 deadlock발생됨\r
+               - 양쪽에서 모두 pthread_cond_wait에서 대기\r
+       * sync event는 한쪽 thread에서만 발생되도록 보장되어야 함.\r
+               - tdm-thread -> main-thread방향으로만 sync event전달만 허용\r
+       * sync event의 종류\r
+               - backend에서 스스로 발생되는 event들만 가능\r
+               - output status변경중에 connection/disconnection, virtual output creation/destruction\r
+end note\r
+\r
+@enduml\r