Statistics
| Branch: | Revision:

urtware / doc / activitydiagrams / core / urtCoreSynchronizeNodes.uml @ dd31cb03

History | View | Annotate | Download (2.422 KB)

1 e48e1ccf 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**\nurtCoreSynchronizeNodes()\n
27
28
/'### PARAMETERS & RETURN ####################################################'/
29
30
note
31
  -- **node** : urt_node_t* --
32 e87bd7c7 Thomas Schöpping
  Pointer to a node to synchronize.
33 e48e1ccf Thomas Schöpping
  Must not be ""NULL"".
34
  ====
35
  -- **return** : urt_status_t --
36 e87bd7c7 Thomas Schöpping
  Returns ""URT_STATUS_OK"" if all nodes are synchronized and proceed.
37 dd31cb03 Thomas Schöpping
  Returns ""URT_STATUS_SYNC_ERROR"" if an exception occurred (faulty stage value detected).
38
  Returns ""URT_STATUS_SYNC_PENDING"" if there are nodes left to synchronize.
39 e87bd7c7 Thomas Schöpping
  In the latter case, the node thread must still wait for the control event (proceed) to synchronize.
40 e48e1ccf Thomas Schöpping
endnote
41
42
/'### PROCEDURE ##############################################################'/
43
44
start
45 e87bd7c7 Thomas Schöpping
:lock core;
46
:increment the node's stage value;
47
:access first node core's list of nodes;
48
while (Current node is not ""NULL""\nand stage of current node is equal to argument?) is (yes)
49
  :proceed to next node;
50
endwhile (no)
51 dd31cb03 Thomas Schöpping
if (All nodes are at the same stage?) then (yes)
52
  :broadcast control event (proceed);
53 e87bd7c7 Thomas Schöpping
  :unlock core;
54
  stop
55
  note
56 dd31cb03 Thomas Schöpping
    Returns ""URT_STATUS_OK"".
57 e87bd7c7 Thomas Schöpping
  endnote
58 dd31cb03 Thomas Schöpping
elseif (The stage of the last checked node was one less than the argument?) then (yes)
59 e87bd7c7 Thomas Schöpping
  :unlock core;
60
  stop
61
  note
62 dd31cb03 Thomas Schöpping
    Returns a ""URT_STATUS_SYNC_PENDING"".
63 e87bd7c7 Thomas Schöpping
  endnote
64
else (no)
65 dd31cb03 Thomas Schöpping
  :call ""urtCoreStopNodes(URT_STATUS_SYNC_ERROR)"";
66 e87bd7c7 Thomas Schöpping
  :unlock core;
67
  stop
68
  note
69 dd31cb03 Thomas Schöpping
    Returns ""URT_STATUS_SYNC_ERROR"".
70 e87bd7c7 Thomas Schöpping
  endnote
71
endif
72 e48e1ccf Thomas Schöpping
73
/'### OUTRO ##################################################################'/
74
75
@enduml