urtware / doc / activitydiagrams / subscriber / hrtsubscriber / urtHrtSubscriberUnsubscribe.uml @ 17d978fe
History | View | Annotate | Download (3.018 KB)
1 | ee83a495 | Thomas Schöpping | /' |
---|---|---|---|
2 | µRtWare is a lightweight publish/subscribe middleware for real-time |
||
3 | applications. It was developed as part of the software habitat for the |
||
4 | Autonomous Mini Robot [1] (AMiRo) but can be used for other purposes as well. |
||
5 | |||
6 | Copyright (C) 2018..2020 Thomas Schöpping et al. |
||
7 | |||
8 | This program is free software: you can redistribute it and/or modify |
||
9 | it under the terms of the GNU General Public License as published by |
||
10 | the Free Software Foundation, either version 3 of the License, or |
||
11 | (at your option) any later version. |
||
12 | |||
13 | This program is distributed in the hope that it will be useful, |
||
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
16 | GNU General Public License for more details. |
||
17 | |||
18 | You should have received a copy of the GNU General Public License |
||
19 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
||
20 | '/ |
||
21 | |||
22 | /'### INTRO ##################################################################'/ |
||
23 | |||
24 | @startuml |
||
25 | |||
26 | title **µRtWare**\nurtHrtSubscriberUnsubscribe()\n |
||
27 | |||
28 | /'### PARAMETERS & RETURN ####################################################'/ |
||
29 | |||
30 | note |
||
31 | -- **subscriber** : urt_hrtsubscriber_t* -- |
||
32 | The HRT subscriber to be unsubscribed. |
||
33 | Must not be ""NULL"". |
||
34 | ==== |
||
35 | -- **return** : urt_status_t -- |
||
36 | Returns ""URT_STATUS_OK"" on sucess. |
||
37 | dd31cb03 | Thomas Schöpping | Returns ""URT_STATUS_UNSUBSCRIBE_NOTOPIC"" if the subscriber is not associated to a topic. |
38 | ee83a495 | Thomas Schöpping | endnote |
39 | |||
40 | /'### PROCEDURE ##############################################################'/ |
||
41 | |||
42 | dd31cb03 | Thomas Schöpping | start |
43 | ee83a495 | Thomas Schöpping | if (Associated to a topic?) then (yes) |
44 | :lock topic; |
||
45 | fork |
||
46 | :unregister event; |
||
47 | note |
||
48 | Must be within lock because of HRT counter. |
||
49 | endnote |
||
50 | fork again |
||
51 | :decrement topic's HRT counter; |
||
52 | fork again |
||
53 | dd31cb03 | Thomas Schöpping | #EEEEEE:..//URT_CFG_PUBSUB_PROFILING == true//..\ndecrement counter of subscribers (@topic); |
54 | fork again |
||
55 | partition "//URT_CFG_PUBSUB_QOS_RATECHECKS == true//" #EEEEEE { |
||
56 | #EEEEEE:remove self from topic's list of HRT subscribers; |
||
57 | if (Was the most critical subscriber?) then (yes) |
||
58 | #EEEEEE:update QoS rate timer (@topic) wrt. most critical HRT subscriber; |
||
59 | else (no) |
||
60 | endif |
||
61 | } |
||
62 | ee83a495 | Thomas Schöpping | fork again |
63 | dd31cb03 | Thomas Schöpping | partition "fetch pending messages" { |
64 | :access last read message; |
||
65 | while (Timestamp of next message is younger?) is (yes) |
||
66 | ee83a495 | Thomas Schöpping | :proceed to next message; |
67 | dd31cb03 | Thomas Schöpping | fork |
68 | :decrement message's HRT counter; |
||
69 | fork again |
||
70 | #EEEEEE:..//URT_CFG_PUBSUB_PROFILING == true//..\ndecremnt message's consumer counter; |
||
71 | endfork |
||
72 | endwhile (no) |
||
73 | if (The HRT counter of any message became 0?) then (yes) |
||
74 | :signal topic's condition variable; |
||
75 | else (no) |
||
76 | endif |
||
77 | } |
||
78 | ee83a495 | Thomas Schöpping | endfork |
79 | :unlock topic; |
||
80 | :reset members; |
||
81 | note |
||
82 | -- urt_basesubscriber_t -- |
||
83 | dd31cb03 | Thomas Schöpping | * **topic** ← ""NULL"" |
84 | * **lastMessage** ← ""NULL"" |
||
85 | * **lastMessageTime** ← 0 |
||
86 | ee83a495 | Thomas Schöpping | endnote |
87 | stop |
||
88 | note |
||
89 | Returns ""URT_STATUS_OK"". |
||
90 | endnote |
||
91 | else (no) |
||
92 | stop |
||
93 | note |
||
94 | dd31cb03 | Thomas Schöpping | Returns ""URT_STATUS_UNSUBSCRIBE_NOTOPIC"". |
95 | ee83a495 | Thomas Schöpping | endnote |
96 | endif |
||
97 | |||
98 | /'### OUTRO ##################################################################'/ |
||
99 | |||
100 | @enduml |