Statistics
| Branch: | Revision:

urtware / doc / activitydiagrams / subscriber / urtSubscriberUnsubscribe.uml @ c22d21ad

History | View | Annotate | Download (2.451 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**\nurtSubscriberUnsubscribe()\n
27

    
28
!include ../../functions.iuml
29

    
30
/'### PARAMETERS & START #####################################################'/
31

    
32
start
33
note
34
  -- ""**subscriber** : urt_subscriber_t*"" --
35
  The subscriber to be unsubscribed.
36
  Must not be ""NULL"".
37
end note
38

    
39
/'### PROCEDURE ##############################################################'/
40

    
41
if (Associated to a topic?) then (yes)
42
  if (Is HRT subscriber?) then (yes)
43
    :lock topic;
44
    fork
45
      :unregister event;
46
      note: Must be within lock because of HRT counter.
47
    fork again
48
      :decrement topic's HRT counter;
49
    fork again
50
      :remove self from topic's list of HRT subscribers;
51
      if (Was most critical subscriber?) then (yes)
52
        :update QoS rate timer (@topic);
53
      else (no)
54
      endif
55
    fork again
56
      while (Unfetched messages left?) is (yes)
57
        :decrement HRT counter;
58
      endwhile (no)
59
      if (At least one HRT counter became 0?) then (yes)
60
        :signal topic's condition variable;
61
      else (no)
62
      endif
63
    endfork
64
    :unlock topic;
65
  else (no)
66
    :unregister event;
67
  endif
68
  :reset members;
69
  :return ""URT_STATUS_OK"";
70
else (no)
71
  :return ""URT_STATUS_ERROR"";
72
endif
73

    
74
/'### STOP & RETURN ##########################################################'/
75

    
76
stop
77
note
78
  -- **return** ""urt_status_t"" --
79
  Returns ""URT_STATUS_ERROR"" if the subscriber was not associated to any topic.
80
end note
81

    
82
/'### OUTRO ##################################################################'/
83

    
84
@enduml