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
PolledQueue.h
00001 /* 00002 * Copyright (c) 2018-2019, Arm Limited and affiliates. 00003 * SPDX-License-Identifier: Apache-2.0 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 #ifndef POLLED_QUEUE_H 00019 #define POLLED_QUEUE_H 00020 00021 #include "drivers/internal/TaskQueue.h" 00022 #include "platform/Callback.h" 00023 #include "LinkedList.h" 00024 namespace events { 00025 /** 00026 * \defgroup drivers_PolledQueue PolledQueue class 00027 * \ingroup drivers-internal-api-usb 00028 * @{ 00029 */ 00030 00031 /** PolledQueue 00032 * 00033 * This class is an implementation of TaskQueue which is 00034 * processed synchronously by calls to dispatch. 00035 */ 00036 class PolledQueue: public TaskQueue { 00037 public: 00038 00039 /** Create a PolledQueue 00040 * 00041 * Create an event queue. 00042 * 00043 * @param cb Callback called when dispatch needs to be called 00044 */ 00045 PolledQueue(mbed::Callback<void()> cb = NULL); 00046 00047 virtual ~PolledQueue(); 00048 00049 virtual void post(TaskBase *event); 00050 00051 virtual void cancel(TaskBase *event); 00052 00053 /** 00054 * Process all the events in this queue 00055 */ 00056 void dispatch(); 00057 00058 /** 00059 * Attach a callback indicating that this queue needs to be processed 00060 * 00061 * @param cb Callback called when dispatch needs to be called 00062 */ 00063 void attach(mbed::Callback<void()> cb); 00064 00065 protected: 00066 00067 mbed::Callback<void()> _cb; 00068 LinkedList<TaskBase> _list; 00069 00070 }; 00071 00072 /** @}*/ 00073 00074 } 00075 #endif
Generated on Tue Jul 12 2022 13:54:42 by
