Lines 14-20
Link Here
|
14 |
|
14 |
|
15 |
namespace Lucene { |
15 |
namespace Lucene { |
16 |
|
16 |
|
17 |
typedef boost::shared_ptr<boost::asio::io_service::work> workPtr; |
17 |
typedef boost::asio::executor_work_guard<boost::asio::io_context::executor_type> workPtr; |
18 |
|
18 |
|
19 |
/// A Future represents the result of an asynchronous computation. Methods are provided to check if the computation |
19 |
/// A Future represents the result of an asynchronous computation. Methods are provided to check if the computation |
20 |
/// is complete, to wait for its completion, and to retrieve the result of the computation. The result can only be |
20 |
/// is complete, to wait for its completion, and to retrieve the result of the computation. The result can only be |
Lines 51-59
public:
Link Here
|
51 |
LUCENE_CLASS(ThreadPool); |
51 |
LUCENE_CLASS(ThreadPool); |
52 |
|
52 |
|
53 |
protected: |
53 |
protected: |
54 |
boost::asio::io_service io_service; |
54 |
boost::asio::thread_pool io_service; |
55 |
workPtr work; |
|
|
56 |
boost::thread_group threadGroup; |
57 |
|
55 |
|
58 |
static const int32_t THREADPOOL_SIZE; |
56 |
static const int32_t THREADPOOL_SIZE; |
59 |
|
57 |
|
Lines 64-70
public:
Link Here
|
64 |
template <typename FUNC> |
62 |
template <typename FUNC> |
65 |
FuturePtr scheduleTask(FUNC func) { |
63 |
FuturePtr scheduleTask(FUNC func) { |
66 |
FuturePtr future(newInstance<Future>()); |
64 |
FuturePtr future(newInstance<Future>()); |
67 |
io_service.post(boost::bind(&ThreadPool::execute<FUNC>, this, func, future)); |
65 |
boost::asio::post(io_service, boost::bind(&ThreadPool::execute<FUNC>, this, func, future)); |
68 |
return future; |
66 |
return future; |
69 |
} |
67 |
} |
70 |
|
68 |
|