Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.

Commit 1a70093

Browse files
committed
Templatize thread pool
1 parent 848c835 commit 1a70093

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/include/threadpool/mono_queue_pool.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ class MonoQueuePool {
3232

3333
void Shutdown();
3434

35-
void SubmitTask(std::function<void()> func);
35+
template <typename F>
36+
void SubmitTask(const F &func);
3637

3738
uint32_t NumWorkers() const { return worker_pool_.NumWorkers(); }
3839

@@ -77,7 +78,8 @@ inline void MonoQueuePool::Shutdown() {
7778
is_running_ = false;
7879
}
7980

80-
inline void MonoQueuePool::SubmitTask(std::function<void()> func) {
81+
template <typename F>
82+
inline void MonoQueuePool::SubmitTask(const F &func) {
8183
if (!is_running_) {
8284
Startup();
8385
}
@@ -118,7 +120,7 @@ inline MonoQueuePool &MonoQueuePool::GetBrainInstance() {
118120
return brain_queue_pool;
119121
}
120122

121-
inline MonoQueuePool &MonoQueuePool::GetExecutionInstance(){
123+
inline MonoQueuePool &MonoQueuePool::GetExecutionInstance() {
122124
int32_t task_queue_size = settings::SettingsManager::GetInt(
123125
settings::SettingId::monoqueue_task_queue_size);
124126
int32_t worker_pool_size = settings::SettingsManager::GetInt(

0 commit comments

Comments
 (0)