@@ -100,7 +100,7 @@ struct am_ao_state_cfg {
100100#define AM_AO_NUM_MAX 64
101101#endif
102102
103- /** Invalid AO priority */
103+ /** Invalid AO priority. */
104104#define AM_AO_PRIO_INVALID -1
105105/** The minimum AO priority level. */
106106#define AM_AO_PRIO_MIN 0
@@ -126,7 +126,7 @@ extern "C" {
126126 * Publish event.
127127 *
128128 * The event is delivered to event queues of all the active objects,
129- * which are subscribed to the event ID.
129+ * which are subscribed to the event ID including the AO publishing the event .
130130 * The event is then handled asynchronously by the active objects.
131131 *
132132 * Use am_ao_subscribe() to subscribe an active object to an event ID.
@@ -139,7 +139,7 @@ extern "C" {
139139 * If your application is prepared for loosing the event,
140140 * then use am_ao_publish_x() function instead.
141141 *
142- * Internally the event is added to subscribed active object event queues
142+ * Internally the event is pushed to subscribed active object event queues
143143 * using am_event_push_back() function.
144144 *
145145 * Tries to free the event, if no active objects are subscribed to it.
@@ -160,6 +160,9 @@ void am_ao_publish(const struct am_event *event);
160160/**
161161 * Same as am_ao_publish(), but the event is not delivered to the given AO.
162162 *
163+ * Might be useful if the AO publishing the event does not want
164+ * the framework to route the same event back to this AO.
165+ *
163166 * @param event the event to publish
164167 * @param ao do not post the event to this active object even
165168 * if it is subscribed to the event.
@@ -171,15 +174,15 @@ void am_ao_publish_exclude(
171174);
172175
173176/**
174- * Publish event.
177+ * Publish event with free space guarantee in destination event queues .
175178 *
176179 * The event is delivered to event queues of all the active objects,
177- * which are subscribed to the event ID.
180+ * which are subscribed to the event ID including the AO publishing the event .
178181 * The event is then handled asynchronously by the active objects.
179182 *
180183 * Use am_ao_subscribe() to subscribe an active object to an event ID.
181- * Use am_ao_unsubscribe() or am_ao_unsubscribe_all() to unsubscribe it
182- * from the event ID .
184+ * Use am_ao_unsubscribe() to unsubscribe it from the event ID
185+ * or am_ao_unsubscribe_all() to unsubscribe it from all event IDs .
183186 *
184187 * If any active object has full event queue and cannot
185188 * accommodate the event, then the function skips the event delivery
@@ -188,7 +191,7 @@ void am_ao_publish_exclude(
188191 * If your application is not prepared for loosing the event,
189192 * then use am_ao_publish() function instead.
190193 *
191- * Internally the event is added to subscribed active object event queues
194+ * Internally the event is pushed to subscribed active object event queues
192195 * using am_event_push_back() function.
193196 *
194197 * Tries to free the event, if it was not delivered to any subscriber.
@@ -214,6 +217,16 @@ bool am_ao_publish_x(const struct am_event *event, int margin);
214217/**
215218 * Same as am_ao_publish_x(), but the event is not delivered to the given AO.
216219 *
220+ * Might be useful if the AO publishing the event does not want
221+ * the library to route the same event back to this AO.
222+ *
223+ * Guarantees availability of \p margin free slots in destination event queues
224+ * after the event was delivered to subscribed active objects.
225+ *
226+ * If any active object has full event queue and cannot
227+ * accommodate the event, then the function skips the event delivery
228+ * to the active object.
229+ *
217230 * @param event the event to publish
218231 * @param margin free event queue slots to be available in each subscribed
219232 * active object after the event is pushed to their event queues
@@ -423,13 +436,13 @@ void am_ao_init_subscribe_list(struct am_ao_subscribe_list *sub, int nsub);
423436/**
424437 * Run all active objects.
425438 *
426- * Executes initial transition of all active objects once on
427- * the first call.
428- *
429- * Blocks forever for preemptive AO build.
439+ * Blocks for preemptive AO build and returns when all active objects
440+ * were stopped.
430441 *
431442 * What follows only applies to cooperative build of AO.
432443 *
444+ * Executes initial transition of all newly started active objects.
445+ *
433446 * Non blocking and returns after dispatching zero or one event.
434447 *
435448 * The function is expected to be called repeatedly to dispatch
@@ -440,6 +453,8 @@ void am_ao_init_subscribe_list(struct am_ao_subscribe_list *sub, int nsub);
440453 *
441454 * @retval true dispatched one event
442455 * @retval false dispatched no events
456+ * Call am_ao_get_cnt() to make sure there are still
457+ * started active objects available.
443458 */
444459bool am_ao_run_all (void );
445460
0 commit comments