Remove thread pool selection code for now
This commit is contained in:
parent
9df60f074b
commit
034020e152
4 changed files with 2 additions and 52 deletions
|
@ -1,2 +1 @@
|
||||||
option('base_url', type: 'string', value: 'https://api.originsro.org')
|
option('base_url', type: 'string', value: 'https://api.originsro.org')
|
||||||
option('thread_pool', type: 'combo', description: '', choices: ['roar11', 'taskflow'], value: 'roar11')
|
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define THREADPOOL_ROAR11 1
|
|
||||||
#define THREADPOOL_TASKFLOW 2
|
|
||||||
|
|
||||||
#define THREADPOOL THREADPOOL_@THREAD_POOL_TYPE@
|
|
||||||
|
|
||||||
namespace duck {
|
namespace duck {
|
||||||
|
|
||||||
constexpr const char g_base_url[] = "@BASE_URL@";
|
constexpr const char g_base_url[] = "@BASE_URL@";
|
||||||
|
|
|
@ -2,37 +2,11 @@
|
||||||
#include "html_fetch_task.hpp"
|
#include "html_fetch_task.hpp"
|
||||||
#include "eventia/eventia.hpp"
|
#include "eventia/eventia.hpp"
|
||||||
#include "eventia/timer.hpp"
|
#include "eventia/timer.hpp"
|
||||||
|
|
||||||
#include "orotool_config.hpp"
|
|
||||||
#if THREADPOOL == THREADPOOL_TASKFLOW
|
|
||||||
# include <taskflow/taskflow.hpp>
|
|
||||||
#elif THREADPOOL == THREADPOOL_ROAR11
|
|
||||||
#include "roar11/ThreadPool.hpp"
|
#include "roar11/ThreadPool.hpp"
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#if THREADPOOL == THREADPOOL_TASKFLOW
|
|
||||||
namespace tf {
|
|
||||||
class Taskflow;
|
|
||||||
class Subflow;
|
|
||||||
} //namespace tf
|
|
||||||
#elif THREADPOOL == THREADPOOL_ROAR11
|
|
||||||
namespace roar11 {
|
|
||||||
class ThreadPool;
|
|
||||||
} //namespace roar11
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace duck {
|
namespace duck {
|
||||||
namespace {
|
namespace {
|
||||||
#if THREADPOOL == THREADPOOL_ROAR11
|
|
||||||
typedef roar11::ThreadPool threadpool_type;
|
|
||||||
typedef roar11::ThreadPool subpool_type;
|
|
||||||
#elif THREADPOOL == THREADPOOL_TASKFLOW
|
|
||||||
typedef tf::Taskflow threadpool_type;
|
|
||||||
typedef tf::Subflow subpool_type;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//class KeepaliveTimer : public ev::timer {
|
//class KeepaliveTimer : public ev::timer {
|
||||||
//public:
|
//public:
|
||||||
// KeepaliveTimer (ev::loop_ref& loop, RunningPool::subpool_type*) {
|
// KeepaliveTimer (ev::loop_ref& loop, RunningPool::subpool_type*) {
|
||||||
|
@ -45,17 +19,10 @@ namespace {
|
||||||
// }
|
// }
|
||||||
//};
|
//};
|
||||||
|
|
||||||
#if THREADPOOL == THREADPOOL_TASKFLOW
|
void join(roar11::ThreadPool& pool) {
|
||||||
void join(tf::Executor& executor) {
|
|
||||||
executor.wait_for_all();
|
|
||||||
std::cout << "all tasks completed\n";
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void join(threadpool_type& pool) {
|
|
||||||
pool.join();
|
pool.join();
|
||||||
std::cout << "all tasks completed\n";
|
std::cout << "all tasks completed\n";
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
} //unnamed namespace
|
} //unnamed namespace
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,6 @@ sqlitecpp_dep = dependency('sqlitecpp', version: '>=3.0.0',
|
||||||
|
|
||||||
ev_dep = dependency('libev', version: '>=4.31')
|
ev_dep = dependency('libev', version: '>=4.31')
|
||||||
threads_dep = dependency('threads')
|
threads_dep = dependency('threads')
|
||||||
if get_option('thread_pool') == 'taskflow'
|
|
||||||
taskflow_dep = dependency('Cpp-Taskflow', version: '>=2.4.0', method: 'cmake')
|
|
||||||
endif
|
|
||||||
|
|
||||||
base_url = get_option('base_url').strip()
|
base_url = get_option('base_url').strip()
|
||||||
if not base_url.endswith('/')
|
if not base_url.endswith('/')
|
||||||
|
@ -22,11 +19,6 @@ endif
|
||||||
|
|
||||||
conf = configuration_data()
|
conf = configuration_data()
|
||||||
conf.set('BASE_URL', base_url)
|
conf.set('BASE_URL', base_url)
|
||||||
if get_option('thread_pool') == 'roar11'
|
|
||||||
conf.set('THREAD_POOL_TYPE', 'ROAR11')
|
|
||||||
elif get_option('thread_pool') == 'taskflow'
|
|
||||||
conf.set('THREAD_POOL_TYPE', 'TASKFLOW')
|
|
||||||
endif
|
|
||||||
project_config_file = configure_file(
|
project_config_file = configure_file(
|
||||||
input: 'config.hpp.in',
|
input: 'config.hpp.in',
|
||||||
output: meson.project_name() + '_config.hpp',
|
output: meson.project_name() + '_config.hpp',
|
||||||
|
@ -39,9 +31,6 @@ lib_deps = [
|
||||||
ev_dep,
|
ev_dep,
|
||||||
threads_dep,
|
threads_dep,
|
||||||
]
|
]
|
||||||
if get_option('thread_pool') == 'taskflow'
|
|
||||||
lib_deps += [taskflow_dep]
|
|
||||||
endif
|
|
||||||
|
|
||||||
executable(meson.project_name(),
|
executable(meson.project_name(),
|
||||||
'main.cpp',
|
'main.cpp',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue