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