Statistics
| Branch: | Revision:

urtware / doc / activitydiagrams / subscriber / hrtsubscriber / urtHrtSubscriberUnsubscribe.uml @ 65dc89cb

History | View | Annotate | Download (3.018 KB)

1
/'
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
  Returns ""URT_STATUS_UNSUBSCRIBE_NOTOPIC"" if the subscriber is not associated to a topic.
38
endnote
39

    
40
/'### PROCEDURE ##############################################################'/
41

    
42
start
43
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
    #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
  fork again
63
    partition "fetch pending messages" {
64
      :access last read message;
65
      while (Timestamp of next message is younger?) is (yes)
66
        :proceed to next message;
67
        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
  endfork
79
  :unlock topic;
80
  :reset members;
81
  note
82
    -- urt_basesubscriber_t --
83
    * **topic** ← ""NULL""
84
    * **lastMessage** ← ""NULL""
85
    * **lastMessageTime** ← 0
86
  endnote
87
  stop
88
  note
89
    Returns ""URT_STATUS_OK"".
90
  endnote
91
else (no)
92
  stop
93
  note
94
    Returns ""URT_STATUS_UNSUBSCRIBE_NOTOPIC"".
95
  endnote
96
endif
97

    
98
/'### OUTRO ##################################################################'/
99

    
100
@enduml