10 #include <boost/asio.hpp>
11 #include <boost/any.hpp>
12 #include <boost/thread/thread.hpp>
17 typedef boost::shared_ptr<boost::asio::io_service::work>
workPtr;
30 void set(
const boost::any& value) {
35 template <
typename TYPE>
38 while (value.empty()) {
41 return value.empty() ? TYPE() : boost::any_cast<TYPE>(
value);
64 template <
typename FUNC>
67 io_service.post(boost::bind(&ThreadPool::execute<FUNC>,
this, func, future));
73 template <
typename FUNC>
boost::shared_ptr< boost::asio::io_service::work > workPtr
Definition: ThreadPool.h:17
boost::shared_ptr< ThreadPool > ThreadPoolPtr
Definition: LuceneTypes.h:553
static ThreadPoolPtr getInstance()
Get singleton thread pool instance.
workPtr work
Definition: ThreadPool.h:55
Utility class to handle a pool of threads.
Definition: ThreadPool.h:46
void execute(FUNC func, const FuturePtr &future)
Definition: ThreadPool.h:74
boost::any value
Definition: ThreadPool.h:27
A Future represents the result of an asynchronous computation. Methods are provided to check if the c...
Definition: ThreadPool.h:22
virtual void wait(int32_t timeout=0)
Wait for signal using an optional timeout.
void set(const boost::any &value)
Definition: ThreadPool.h:30
Utility class to support scope locking.
Definition: Synchronize.h:44
boost::thread_group threadGroup
Definition: ThreadPool.h:56
Base class for all Lucene classes.
Definition: LuceneObject.h:31
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Definition: AbstractAllTermDocs.h:12
static const int32_t THREADPOOL_SIZE
Definition: ThreadPool.h:58
boost::shared_ptr< Future > FuturePtr
Definition: LuceneTypes.h:530
boost::asio::io_service io_service
Definition: ThreadPool.h:51
FuturePtr scheduleTask(FUNC func)
Definition: ThreadPool.h:65