Statistics
| Branch: | Revision:

urtware / doc / activitydiagrams / subscriber / urtSubscriberUnsubscribe.uml @ 7491c395

History | View | Annotate | Download (2.498 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
        :lock message;
58
        :decrement HRT counter;
59
        :unlock message;
60
      endwhile (no)
61
      if (At least one HRT counter became 0?) then (yes)
62
        :signal topic's condition variable;
63
      else (no)
64
      endif
65
    endfork
66
    :unlock topic;
67
  else (no)
68
    :unregister event;
69
  endif
70
  :reset members;
71
  :return ""URT_STATUS_OK"";
72
else (no)
73
  :return ""URT_STATUS_ERROR"";
74
endif
75

    
76
/'### STOP & RETURN ##########################################################'/
77

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

    
84
/'### OUTRO ##################################################################'/
85

    
86
@enduml