Statistics
| Branch: | Revision:

urtware / doc / activitydiagrams / request / functions.iuml @ 2d315870

History | View | Annotate | Download (1.959 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
/' Acquire a request (blocking). '/
23
!function $acquire_request()
24
  start
25
  :lock request;
26
  note
27
    Execution is blocked until mutex is locked.
28
  endnote
29
  if (Request is owned by a service?) then (yes)
30
    :unlock request;
31
    stop
32
    note
33
      Returns ""URT_STATUS_REQUEST_BADOWNER"".
34
    endnote
35
  else (no)
36
    stop
37
    note
38
      Returns ""URT_STATUS_OK"".
39
    endnote
40
  endif
41
!endfunction
42

    
43
/' Try to acquire a request (non blocking). '/
44
!function $try_acquire_request()
45
  start
46
  :lock request;
47
  note
48
    Does not block.
49
  endnote
50
  if (Request could be locked?) then (yes)
51
    if (Request is owned by a service?) then (yes)
52
      :unlock request;
53
      stop
54
      note
55
        Returns ""URT_STATUS_REQUEST_BADOWNER"".
56
      endnote
57
    else (no)
58
      stop
59
      note
60
        Returns ""URT_STATUS_OK"".
61
      endnote
62
    endif
63
  else (no)
64
    stop
65
    note
66
      Returns ""URT_STATUS_REQUEST_LOCKED"".
67
    endnote
68
  endif
69
!endfunction
70

    
71
/' Release a previously acquired request. '/
72
!function $release_request()
73
  start
74
  :unlock request;
75
  stop
76
  note
77
    Returns ""URT_STATUS_OK"".
78
  endnote
79
!endfunction