Remove thread pool selection code for now

This commit is contained in:
King_DuckZ 2020-08-09 20:04:22 +01:00
parent 9df60f074b
commit 034020e152
4 changed files with 2 additions and 52 deletions

View file

@ -1,2 +1 @@
option('base_url', type: 'string', value: 'https://api.originsro.org')
option('thread_pool', type: 'combo', description: '', choices: ['roar11', 'taskflow'], value: 'roar11')

View file

@ -1,10 +1,5 @@
#pragma once
#define THREADPOOL_ROAR11 1
#define THREADPOOL_TASKFLOW 2
#define THREADPOOL THREADPOOL_@THREAD_POOL_TYPE@
namespace duck {
constexpr const char g_base_url[] = "@BASE_URL@";

View file

@ -2,37 +2,11 @@
#include "html_fetch_task.hpp"
#include "eventia/eventia.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"
#endif
#include "roar11/ThreadPool.hpp"
#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 {
#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 {
//public:
// KeepaliveTimer (ev::loop_ref& loop, RunningPool::subpool_type*) {
@ -45,17 +19,10 @@ namespace {
// }
//};
#if THREADPOOL == THREADPOOL_TASKFLOW
void join(tf::Executor& executor) {
executor.wait_for_all();
std::cout << "all tasks completed\n";
}
#else
void join(threadpool_type& pool) {
void join(roar11::ThreadPool& pool) {
pool.join();
std::cout << "all tasks completed\n";
}
#endif
} //unnamed namespace

View file

@ -11,9 +11,6 @@ sqlitecpp_dep = dependency('sqlitecpp', version: '>=3.0.0',
ev_dep = dependency('libev', version: '>=4.31')
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()
if not base_url.endswith('/')
@ -22,11 +19,6 @@ endif
conf = configuration_data()
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(
input: 'config.hpp.in',
output: meson.project_name() + '_config.hpp',
@ -39,9 +31,6 @@ lib_deps = [
ev_dep,
threads_dep,
]
if get_option('thread_pool') == 'taskflow'
lib_deps += [taskflow_dep]
endif
executable(meson.project_name(),
'main.cpp',