Event queue doc update. This closes #153. This closes #154.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/commit/311f005d Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/tree/311f005d Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/diff/311f005d Branch: refs/heads/master Commit: 311f005d54473f4453d345fa964da5cb7d8f19c7 Parents: 55a2604 Author: aditihilbert <[email protected]> Authored: Mon Feb 20 08:14:10 2017 -0800 Committer: aditihilbert <[email protected]> Committed: Mon Feb 20 08:29:45 2017 -0800 ---------------------------------------------------------------------- .../core_os/event_queue/os_eventq_designate.md | 44 ++++++++++++++++++++ docs/os/core_os/event_queue/os_eventq_run.md | 40 ++++++++++++++++++ 2 files changed, 84 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/311f005d/docs/os/core_os/event_queue/os_eventq_designate.md ---------------------------------------------------------------------- diff --git a/docs/os/core_os/event_queue/os_eventq_designate.md b/docs/os/core_os/event_queue/os_eventq_designate.md new file mode 100644 index 0000000..901231e --- /dev/null +++ b/docs/os/core_os/event_queue/os_eventq_designate.md @@ -0,0 +1,44 @@ +## <font color="F2853F" style="font-size:24pt"> os_eventq_designate</font> + +```c + void + os_eventq_designate(struct os_eventq **cur_evq, struct os_eventq *new_evq, struct os_event *start_ev) +``` + +Reassigns a package's current event queue pointer to point to a new event queue. If a startup event +is specified, the event is added to the new event queue and removed from the current event queue. + + +#### Arguments + +| Arguments | Description | +|-----------|-------------| +| `cur_evq`| Current event queue pointer to reassign | +| `new_evq` | New event queue to use for the package | +| `start_ev` | Start event to add to the new event queue | + +#### Returned values + +None + +#### Notes + + +#### Example + +<Add text to set up the context for the example here> + +This example shows the `mgmt_evq_set()` function that the `mgmt/newtmgr` package implements. The function +allows an application to specify an event queue for `newtmgr` to use. The `mgmt_evq_set()` function calls the `os_eventq_designate()` function to reassign the `nmgr_evq` to the event queue that the application specifies. + + +```c +void +mgmt_evq_set(struct os_eventq *evq) +{ + os_eventq_designate(&nmgr_evq, evq, NULL); +} + + +``` + http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/311f005d/docs/os/core_os/event_queue/os_eventq_run.md ---------------------------------------------------------------------- diff --git a/docs/os/core_os/event_queue/os_eventq_run.md b/docs/os/core_os/event_queue/os_eventq_run.md new file mode 100644 index 0000000..52a754c --- /dev/null +++ b/docs/os/core_os/event_queue/os_eventq_run.md @@ -0,0 +1,40 @@ +## <font color="F2853F" style="font-size:24pt"> os_eventq_run</font> + +```c + void + os_eventq_run(struct os_eventq *evq) +``` +Wrapper function that calls the `os_eventq_get()` function to dequeue the event from the head of the event queue and then calls the callback function for the event. + +#### Arguments + +| Arguments | Description | +|-----------|-------------| +| `evq`| Event queue to dequeue the event from | + +#### Returned values + +None + +#### Notes + + +#### Example + +<Add text to set up the context for the example here> +This example shows an application `main()` that calls the `os_eventq_run()` function to process events from the OS default event queue in an infinite loop. + +```c +int +main(int argc, char **argv) +{ + + sysinit(); + ... + + while (1) { + os_eventq_run(os_eventq_dflt_get()); + } +} +``` +
