Mistake on this page?
Report an issue in GitHub or email us
PolledQueue.h
1 /*
2  * Copyright (c) 2018-2019, Arm Limited and affiliates.
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef POLLED_QUEUE_H
19 #define POLLED_QUEUE_H
20 
21 #include "drivers/internal/TaskQueue.h"
22 #include "platform/Callback.h"
23 #include "LinkedList.h"
24 namespace events {
25 /**
26  * \defgroup drivers_PolledQueue PolledQueue class
27  * \ingroup drivers-internal-api-usb
28  * @{
29  */
30 
31 /** PolledQueue
32  *
33  * This class is an implementation of TaskQueue which is
34  * processed synchronously by calls to dispatch.
35  */
36 class PolledQueue: public TaskQueue {
37 public:
38 
39  /** Create a PolledQueue
40  *
41  * Create an event queue.
42  *
43  * @param cb Callback called when dispatch needs to be called
44  */
45  PolledQueue(mbed::Callback<void()> cb = NULL);
46 
47  virtual ~PolledQueue();
48 
49  virtual void post(TaskBase *event);
50 
51  virtual void cancel(TaskBase *event);
52 
53  /**
54  * Process all the events in this queue
55  */
56  void dispatch();
57 
58  /**
59  * Attach a callback indicating that this queue needs to be processed
60  *
61  * @param cb Callback called when dispatch needs to be called
62  */
63  void attach(mbed::Callback<void()> cb);
64 
65 protected:
66 
69 
70 };
71 
72 /** @}*/
73 
74 }
75 #endif
virtual void cancel(TaskBase *event)
Cancel an in-flight event.
TaskBase.
Definition: TaskBase.h:43
PolledQueue(mbed::Callback< void()> cb=NULL)
Create a PolledQueue.
PolledQueue.
Definition: PolledQueue.h:36
virtual void post(TaskBase *event)
Add this event to the queue for execution.
void attach(mbed::Callback< void()> cb)
Attach a callback indicating that this queue needs to be processed.
TaskQueue.
Definition: TaskQueue.h:39
void dispatch()
Process all the events in this queue.
Callback class based on template specialization.
Definition: Callback.h:39
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.