activemq-cpp-3.8.2
CompositeTaskRunner.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. 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 _ACTIVEMQ_THREADS_COMPOSITETASKRUNNER_H_
19 #define _ACTIVEMQ_THREADS_COMPOSITETASKRUNNER_H_
20 
21 #include <activemq/util/Config.h>
24 #include <decaf/util/StlSet.h>
25 #include <decaf/util/LinkedList.h>
26 #include <decaf/lang/Thread.h>
27 #include <decaf/lang/Runnable.h>
29 #include <decaf/lang/Pointer.h>
30 
31 namespace activemq {
32 namespace threads {
33 
42  public decaf::lang::Runnable {
43  private:
44 
46  mutable decaf::util::concurrent::Mutex mutex;
47 
49 
50  bool threadTerminated;
51  bool pending;
52  bool shutDown;
53 
54  private:
55 
57  CompositeTaskRunner& operator=(const CompositeTaskRunner&);
58 
59  public:
60 
62 
63  virtual ~CompositeTaskRunner();
64 
65  virtual void start();
66 
67  virtual bool isStarted() const;
68 
73  void addTask(CompositeTask* task);
74 
79  void removeTask(CompositeTask* task);
80 
87  virtual void shutdown(long long timeout);
88 
92  virtual void shutdown();
93 
99  virtual void wakeup();
100 
101  protected:
102 
103  virtual void run();
104 
105  virtual bool iterate();
106 
107  };
108 
109 }}
110 
111 #endif /* _ACTIVEMQ_THREADS_COMPOSITETASKRUNNER_H_ */
Represents a unit of work that requires one or more iterations to complete.
Definition: Task.h:31
Mutex object that offers recursive support on all platforms as well as providing the ability to use t...
Definition: Mutex.h:39
#define AMQCPP_API
Definition: Config.h:30
A Task Runner that can contain one or more CompositeTasks that are each checked for pending work and ...
Definition: CompositeTaskRunner.h:40
Represents a single task that can be part of a set of Tasks that are contained in a CompositeTaskRunn...
Definition: CompositeTask.h:33
Interface for a runnable object - defines a task that can be run by a thread.
Definition: Runnable.h:29
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: CachedConsumer.h:24
Definition: TaskRunner.h:27
A complete implementation of the List interface using a doubly linked list data structure.
Definition: LinkedList.h:55