Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
mbed_shared_queues.h
00001 /* 00002 * Copyright (c) 2016-2019 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 #ifndef MBED_SHARED_QUEUES_H 00017 #define MBED_SHARED_QUEUES_H 00018 00019 #include "events/EventQueue.h" 00020 00021 namespace mbed { 00022 /** \addtogroup events-public-api */ 00023 /** @{*/ 00024 00025 /** 00026 * Return a pointer to an EventQueue, on which normal tasks can be queued. 00027 * 00028 * All calls to this return the same EventQueue - it and its dispatch thread 00029 * are created on the first call to this function. The dispatch thread 00030 * runs at default priority (currently osPriorityNormal). 00031 * 00032 * The EventQueue returned may be used to call() Events, or to chain() other 00033 * EventQueues so that they are run in the same context. 00034 * 00035 * Events (or chained EventQueues) executing on the normal event queue should 00036 * normally take less than 10ms to execute, to avoid starving other users. As 00037 * such, users can expect that event latency will typically be 10ms or less, 00038 * but could occasionally be significantly higher if many events are queued. 00039 * 00040 * If an RTOS is not present or the configuration option 00041 * `events.shared-dispatch-from-application` is set to true, then this 00042 * does not create a dedicated dispatch thread - instead the application is 00043 * expected to run the EventQueue's dispatch, for example from main. This is 00044 * necessary for the event loop to work without an RTOS, or an RTOS system can 00045 * save memory by reusing the main stack. 00046 * 00047 * @note 00048 * mbed_event_queue is not itself IRQ safe. To use the mbed_event_queue in 00049 * interrupt context, you must first call `mbed_event_queue()` in threaded 00050 * context and store the pointer for later use. 00051 * 00052 * @return pointer to event queue 00053 */ 00054 events::EventQueue *mbed_event_queue(); 00055 00056 #ifdef MBED_CONF_RTOS_PRESENT 00057 /** 00058 * Return a pointer to an EventQueue, on which small high-priority tasks can 00059 * be queues, such as simple deferrals from interrupt. 00060 * 00061 * All calls to this return the same EventQueue - it and its thread are 00062 * created on the first call to this function. The dispatch thread 00063 * runs at a high priority (currently osPriorityHigh). 00064 * 00065 * The EventQueue returned may be used to call() Events, or to chain() other 00066 * EventQueues so that they are run in the same context. 00067 * 00068 * Events (or chained EventQueues) executing on the high-priority event queue 00069 * should normally take less than 100us to execute, to avoid starving other 00070 * users. As such, users can expect that event latency will typically be 100us 00071 * or less, but could occasionally be significantly higher if many events are 00072 * queued. 00073 * 00074 * @note 00075 * mbed_highprio_event_queue is not itself IRQ safe. To use the 00076 * mbed_highprio_event_queue in interrupt context, you must first call 00077 * `mbed_highprio_event_queue()` in threaded context and store the pointer for 00078 * later use. 00079 * 00080 * @return pointer to high-priority event queue 00081 */ 00082 00083 events::EventQueue *mbed_highprio_event_queue(); 00084 00085 #endif // MBED_CONF_RTOS_PRESENT 00086 00087 /** @}*/ 00088 00089 } 00090 00091 #endif
Generated on Tue Jul 12 2022 13:54:34 by
