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 "usb/internal/TaskQueue.h"
22 #include "platform/Callback.h"
23 #include "LinkedList.h"
24 
25 namespace events {
26 /**
27  * \defgroup drivers_PolledQueue PolledQueue class
28  * \ingroup drivers-internal-api-usb
29  * @{
30  */
31 
32 /** PolledQueue
33  *
34  * This class is an implementation of TaskQueue which is
35  * processed synchronously by calls to dispatch.
36  */
37 class PolledQueue: public TaskQueue {
38 public:
39 
40  /** Create a PolledQueue
41  *
42  * Create an event queue.
43  *
44  * @param cb Callback called when dispatch needs to be called
45  */
46  PolledQueue(mbed::Callback<void()> cb = nullptr);
47 
48  virtual ~PolledQueue();
49 
50  virtual void post(TaskBase *event);
51 
52  virtual void cancel(TaskBase *event);
53 
54  /**
55  * Process all the events in this queue
56  */
57  void dispatch();
58 
59  /**
60  * Attach a callback indicating that this queue needs to be processed
61  *
62  * @param cb Callback called when dispatch needs to be called
63  */
64  void attach(mbed::Callback<void()> cb);
65 
66 protected:
67 
70 
71 };
72 
73 /** @}*/
74 
75 }
76 #endif
PolledQueue(mbed::Callback< void()> cb=nullptr)
Create a PolledQueue.
virtual void cancel(TaskBase *event)
Cancel an in-flight event.
TaskBase.
Definition: TaskBase.h:43
PolledQueue.
Definition: PolledQueue.h:37
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:53
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.