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