From 782d100ad830459baaee9f46b179fd4998e80607 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Tue, 3 Apr 2018 16:26:13 +0900 Subject: [PATCH] add plantuml, dot files Change-Id: I99569149d5b46722426a97e8f59e39fa3db526bc --- doc/tdm_header.txt | 109 ++++++++++++++++++++++++++++++++++++++++++++ doc/tdm_thread.txt | 40 ++++++++++++++++ doc/tdm_thread_deadlock.txt | 40 ++++++++++++++++ 3 files changed, 189 insertions(+) create mode 100644 doc/tdm_header.txt create mode 100644 doc/tdm_thread.txt create mode 100644 doc/tdm_thread_deadlock.txt diff --git a/doc/tdm_header.txt b/doc/tdm_header.txt new file mode 100644 index 0000000..59c3cef --- /dev/null +++ b/doc/tdm_header.txt @@ -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 index 0000000..5e6f28f --- /dev/null +++ b/doc/tdm_thread.txt @@ -0,0 +1,40 @@ +@startuml + +hide footbox + +participant "E20 main thread" as main +participant "tdm thread" as sub + +== an asynchronous event == +sub <-- : an asynchronous event +activate sub + sub -> sub: calling thread callbacks in tdm-thread + activate sub + deactivate sub + main <-- sub: sending an asynchronous event +deactivate sub +activate main +main -> main: calling thread callbacks in main-thread +activate main +deactivate main +deactivate main + +== a synchronous event == +sub <-- : a synchronous event +activate sub + sub -> sub: calling thread callbacks in tdm-thread + activate sub + deactivate sub + sub --> main: sending a synchronous event + activate main + sub -> sub: pthread_cond_wait + activate sub + main -> main: calling thread callbacks in main-thread + activate main + deactivate main + main --> sub: pthread_cond_signal + deactivate sub + deactivate main +deactivate sub + +@enduml diff --git a/doc/tdm_thread_deadlock.txt b/doc/tdm_thread_deadlock.txt new file mode 100644 index 0000000..3a01697 --- /dev/null +++ b/doc/tdm_thread_deadlock.txt @@ -0,0 +1,40 @@ +@startuml + +hide footbox + +participant "E20 main thread" as main +participant "tdm thread" as sub + +sub <-- : a synchronous event +activate sub +--> main: a synchronous event +activate main +sub -> sub: calling thread callbacks in tdm-thread +activate sub +deactivate sub +sub --> main: sending a synchronous event +sub -> sub: pthread_cond_wait +activate sub +main -> main: calling thread callbacks in main-thread +activate main +deactivate main +main --> sub: sending a synchronous event +main -> main: pthread_cond_wait +activate main +deactivate sub +deactivate main +deactivate main +deactivate sub + +... (DEADLOCK) ... +note over main, sub + * 만약 main-thread, tdm-thread에서 동시에 synchronous event가 발생되게 되면 deadlock발생됨 + - 양쪽에서 모두 pthread_cond_wait에서 대기 + * sync event는 한쪽 thread에서만 발생되도록 보장되어야 함. + - tdm-thread -> main-thread방향으로만 sync event전달만 허용 + * sync event의 종류 + - backend에서 스스로 발생되는 event들만 가능 + - output status변경중에 connection/disconnection, virtual output creation/destruction +end note + +@enduml -- 2.7.4