Revision dd31cb03 doc/activitydiagrams/publisher/urtPublisherPublish.uml

View differences:

doc/activitydiagrams/publisher/urtPublisherPublish.uml
34 34
  -- **payload** : void* --
35 35
  Pointer to the data to be published.
36 36
  May be ""NULL"" for messages without payload.
37
  -- **n** : size_t --
37
  -- **bytes** : size_t --
38 38
  Size of the payload in bytes.
39 39
  -- **t** : urt_osTime_t --
40 40
  Timestamp to be set for the message.
......
43 43
  ====
44 44
  -- **return** : urt_status_t --
45 45
  Returns ""URT_STATUS_OK"" on success.
46
  Returns ""URT_STATUS_ERROR"" on timeout.
46
  Returns ""URT_STATUS_PUBLISH_TIMEOUT"" on timeout.
47 47
endnote
48 48

  
49 49
/'### PROCEDURE ##############################################################'/
50 50

  
51 51
start
52 52
:lock topic;
53
:access topic's next message;
53
fork
54
  :access topic's next message;
55
fork again
56
  #EEEEEE:..//URT_CFG_PUBSUB_PROFILING == true//..\nincrement counter of publish attempts;
57
endfork
54 58
while (HRT consumers left for the message?) is (yes)
55 59
  :wait for topic's condition variable (using topic's mutex) to be signaled or timeout;
56 60
  if (Timeout occurred?) then (yes)
61
    #EEEEEE:..//URT_CFG_PUBSUB_PROFILING == true//..\nincrement counter of publish fails;
57 62
    :unlock topic;
58 63
    stop
59 64
    note
60
      Returns ""URT_STATUS_ERROR"".
65
      Returns ""URT_STATUS_PUBLISH_TIMEOUT"".
61 66
    endnote
62 67
  else (no)
63 68
    if (Message timestamp was modified?) then (yes)
64
      :access topic's next message;
69
      repeat
70
        :proceed to next message;
71
      repeat while (Timestamp is younger than of previous message?) is (yes)
72
      ->no;
65 73
    else (no)
66 74
    endif
67 75
  endif
68 76
endwhile (no)
77
partition "//URT_CFG_PUBSUB_PROFILING == true//" #EEEEEE {
78
  if (Consumers left for this message?) then (yes)
79
    #EEEEEE:increment counter of discarded messages (@topic);
80
  else (no)
81
  endif
82
}
69 83
fork
70
  fork
71
    :iterate topic pointer to this message;
72
  fork again
73
    :copy payload to message;
74
  fork again
75
    :set origin time of message;
76
  fork again
77
    :set number of HRT consumers (from topic);
78
  endfork
84
  partition "setup message" {
85
    fork
86
      :iterate topic's pointer to this message;
87
    fork again
88
      :copy payload to message;
89
    fork again
90
      :set origin time of message;
91
    fork again
92
      :set number of HRT consumers (from topic);
93
    fork again
94
      #EEEEEE:..//URT_CFG_PUBSUB_PROFILING == true//..
95
       set numer of consumers (from topic);
96
    endfork
97
  }
79 98
fork again
80
  :set QoS rate timer (@topic) wrt. most critical HRT subscriber;
99
  #EEEEEE:..//URT_CFG_PUBSUB_QOS_RATECHECKS == true//..\nset QoS rate timer (@topic) wrt. most critical HRT subscriber;
81 100
fork again
82
  while (HRT subscribers left?) is (yes)
83
    if (QoS delay timer (@subscriber) is not armed?) then (yes)
84
      :set QoS delay timer (@subscriber) wrt. origin time of the message;
85
      note: No lock required since this timer is only accessed when the topic is locked.
86
    else (no)
87
    endif
88
    :iterate to next HRT subscriber;
89
  endwhile (no)
101
  partition "//URT_CFG_PUBSUB_QOS_DEADLINECHECKS == true//" #EEEEEE {
102
    #EEEEEE:access first HRT subscriber of topic;
103
    while (HRT subscriber is not ""NULL""?) is (yes)
104
      if (QoS deadline timer (@subscriber) is not armed?) then (yes)
105
        #EEEEEE:set QoS deadline timer (@subscriber) wrt. origin time of the message;
106
        note
107
          No lock required.
108
          This timer is only accessed while topic is locked.
109
        endnote
110
      else (no)
111
      endif
112
      #EEEEEE:proceed to next HRT subscriber;
113
    endwhile (no)
114
  }
115
fork again
116
  #EEEEEE:..//URT_CFG_PUBSUB_PROFILING == true//..\nincrement counter of published messages (@topic);
90 117
endfork
91 118
:fire event;
92 119
note: Msut be within topic lock because of HRT counter.

Also available in: Unified diff