Statistics
| Branch: | Revision:

urtware / doc / activitydiagrams / node / _main.uml @ e87bd7c7

History | View | Annotate | Download (2.738 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**\n_main()\n
27
28
/'### PARAMETERS & RETURN ####################################################'/
29
30
note
31
  -- **arg** : void* --
32 e87bd7c7 Thomas Schöpping
  Optional Argument to the thread main function (see ""urt_osThreadFunction_t"").
33
  This functions expects no arguments.
34 e48e1ccf Thomas Schöpping
  ====
35
  -- **return** : void --
36
endnote
37
38
/'### PROCEDURE ##############################################################'/
39
40
start
41 e87bd7c7 Thomas Schöpping
partition "setup" {
42
  :register to core event;
43
  if (Node's ""setupcallback"" is set?) then (yes)
44
    :execute ""setupcallback()"";
45
    note
46
      Callback must not loop.
47
    endnote
48
    if (Event mask returned by ""setupcallback()"" redefines core event?) then (yes)
49
      :call ""urtCoreStopNodes(URT_STATUS_ERROR)"";
50
    else (no)
51
    endif
52
  else (no)
53
    :act as if ""stupcallback"" returned 0xF..F;
54
  endif
55
  if (Core status is ""URT_STATUS_OK""?) then (yes)
56
    :suspend all child threads (recursively);
57
    :synchronize by calling ""urtCoreSynchronizeNodes(1)"";
58
    :resume all child threads (recursively);
59
  else (no)
60
  endif
61
}
62
partition "loop" {
63
  while (Thread termination requested?) is (no)
64
    :Wait for a specified or a core event;
65
    if (Core event received?) then (yes)
66
    else (no)
67
      :execute ""loopcallback()"";
68
      note
69
        Callback must not loop.
70
      endnote
71
      if (Event mask returned by ""loopcallback()"" redefines core event?) then (yes)
72
        :call ""urtCoreStopNodes(URT_STATUS_ERROR)"";
73
      else (no)
74
      endif
75
    endif
76
  endwhile
77
}
78
partition "outro" {
79
  if (Node's ""shutdowncallback"" is set?) then (yes)
80
    :execute ""shutdowncallback()"" with core's status as argument;
81
  else (no)
82
  endif
83
  :unregister from core event;
84
  :terminate node thread (and all child threads);
85
}
86 e48e1ccf Thomas Schöpping
stop
87
88
/'### OUTRO ##################################################################'/
89
90
@enduml