Mistake on this page?
Report an issue in GitHub or email us
mbed_shared_queues.h
1 /*
2  * Copyright (c) 2016-2019 ARM Limited
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef MBED_SHARED_QUEUES_H
17 #define MBED_SHARED_QUEUES_H
18 
19 #include "events/EventQueue.h"
20 
21 namespace mbed {
22 /** \addtogroup events-public-api */
23 /** @{*/
24 
25 /**
26  * Return a pointer to an EventQueue, on which normal tasks can be queued.
27  *
28  * All calls to this return the same EventQueue - it and its dispatch thread
29  * are created on the first call to this function. The dispatch thread
30  * runs at default priority (currently osPriorityNormal).
31  *
32  * The EventQueue returned may be used to call() Events, or to chain() other
33  * EventQueues so that they are run in the same context.
34  *
35  * Events (or chained EventQueues) executing on the normal event queue should
36  * normally take less than 10ms to execute, to avoid starving other users. As
37  * such, users can expect that event latency will typically be 10ms or less,
38  * but could occasionally be significantly higher if many events are queued.
39  *
40  * If an RTOS is not present or the configuration option
41  * `events.shared-dispatch-from-application` is set to true, then this
42  * does not create a dedicated dispatch thread - instead the application is
43  * expected to run the EventQueue's dispatch, for example from main. This is
44  * necessary for the event loop to work without an RTOS, or an RTOS system can
45  * save memory by reusing the main stack.
46  *
47  * @note
48  * mbed_event_queue is not itself IRQ safe. To use the mbed_event_queue in
49  * interrupt context, you must first call `mbed_event_queue()` in threaded
50  * context and store the pointer for later use.
51  *
52  * @return pointer to event queue
53  */
55 
56 #ifdef MBED_CONF_RTOS_PRESENT
57 /**
58  * Return a pointer to an EventQueue, on which small high-priority tasks can
59  * be queues, such as simple deferrals from interrupt.
60  *
61  * All calls to this return the same EventQueue - it and its thread are
62  * created on the first call to this function. The dispatch thread
63  * runs at a high priority (currently osPriorityHigh).
64  *
65  * The EventQueue returned may be used to call() Events, or to chain() other
66  * EventQueues so that they are run in the same context.
67  *
68  * Events (or chained EventQueues) executing on the high-priority event queue
69  * should normally take less than 100us to execute, to avoid starving other
70  * users. As such, users can expect that event latency will typically be 100us
71  * or less, but could occasionally be significantly higher if many events are
72  * queued.
73  *
74  * @note
75  * mbed_highprio_event_queue is not itself IRQ safe. To use the
76  * mbed_highprio_event_queue in interrupt context, you must first call
77  * `mbed_highprio_event_queue()` in threaded context and store the pointer for
78  * later use.
79  *
80  * @return pointer to high-priority event queue
81  */
82 
83 events::EventQueue *mbed_highprio_event_queue();
84 
85 #endif // MBED_CONF_RTOS_PRESENT
86 
87 /** @}*/
88 
89 }
90 
91 #endif
EventQueue.
Definition: EventQueue.h:60
events::EventQueue * mbed_event_queue()
Return a pointer to an EventQueue, on which normal tasks can be queued.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.