anchao commented on code in PR #12802:
URL: https://github.com/apache/nuttx/pull/12802#discussion_r1697907869


##########
Documentation/reference/os/events.rst:
##########
@@ -0,0 +1,112 @@
+==============
+Events
+==============
+
+Events groups are synchronization primitives that allow tasks to wait
+for multiple conditions to be met before proceeding. They are particularly
+useful in scenarios where a task needs to wait for several events to occur
+simultaneously.
+This concept can be particularly powerful in real-time operating systems 
(RTOS).
+
+Overview
+=========================
+
+An event group consists of a set of binary flags, each representing a
+specific event. Tasks can set, clear, and wait on these flags. When a
+task waits on an event group, it can specify which flags it is interested
+in and whether it wants to wait for all specified flags to be set or just
+any one of them.
+
+Configuration Options
+=====================
+
+``CONFIG_SCHED_EVENTS``
+        This option enables event objects. Threads may wait on event
+        objects for specific events, but both threads and ISRs may deliver
+        events to event objects.
+
+Common Events Interfaces
+================================
+
+Events Types
+--------------------
+
+-  ``event_t``. Defines one event group entry.
+-  ``event_mask_t``. Defines one events mask value.
+
+Notifier Chain Interfaces
+-------------------------
+
+.. c:function:: int nxevent_init(FAR event_t *event, event_mask_t events)
+
+  Initializes an event object, Set of default events to post
+  to event.
+
+  :param event: Address of the event object
+  :param events: Set of events to event
+
+.. c:function:: int nxevent_destroy(FAR event_t *event)
+
+  This function is used to destroy the event.
+
+  :param event: Address of the event object
+
+.. c:function:: int nxevent_reset(FAR event_t *event, event_mask_t events)
+
+  Reset events mask to a specific value.
+
+  :param event: Address of the event object
+  :param events: Set of events to event
+
+.. c:function:: int nxevent_post(FAR event_t *event, event_mask_t events)
+
+  Post one or more events to an event object.
+
+  This routine posts one or more events to an event object. All tasks
+  waiting on the event object event whose waiting conditions become
+  met by this posting immediately unpend.
+
+  Posting differs from setting in that posted events are merged together
+  with the current set of events tracked by the event object.
+
+  :param event: Address of the event object
+  :param events: Set of events to post to event, 0 will ignored the waiting 
events and wake up the waiting thread
+
+.. c:function:: event_mask_t nxevent_wait(FAR event_t *event, event_mask_t 
events)

Review Comment:
   This depends on the parameters of events:
   
   **nxevent_wait**:
   ANY: If wait events is set to 0, it will be awakened as long as any event 
arrives
   ALL: If wait events is set to the specified masks, it must wait for all 
events to be ready before being awakened
   **nxevent_post**:
   If the post event is set to 0, the waiting event will be ignored and the 
waiting thread will be woken up immediately



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to