Dobby  3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
IDispatcher.h
1 /*
2 * If not stated otherwise in this file or this component's LICENSE file the
3 * following copyright and licenses apply:
4 *
5 * Copyright 2014 Sky UK
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19 /*
20  * File: IDispatcher.h
21  * Author: jarek.dziedzic@bskyb.com
22  *
23  * Created on 26 June 2014
24  *
25  */
26 #ifndef IDISPATCHER_H
27 #define IDISPATCHER_H
28 
29 #include "Polymorphic.h"
30 #include <functional>
31 #include <thread>
32 #include <memory>
33 
34 namespace AICommon
35 {
36 
40 class IDispatcher : public Polymorphic
41 {
42 public:
46  virtual void post(std::function<void ()> work) = 0;
47 
52  virtual void sync() = 0;
53 
57  virtual bool invokedFromDispatcherThread() = 0;
58 };
59 
60 } //AICommon
61 
62 #endif /* IDISPATCHER_H */
63 
A dispatcher interface.
Definition: IDispatcher.h:41
virtual void post(std::function< void()> work)=0
virtual void sync()=0
Ensures that anything that was in the queue before the call has been executed before returning.
virtual bool invokedFromDispatcherThread()=0
If it is a threaded dispatcher then the dispatcher thread id, otherwise nullptr.
Inherit from this from all types that have virtual functions.
Definition: Polymorphic.h:39