Skip to content
Snippets Groups Projects
Commit 28ea72ef authored by Florian Fischer's avatar Florian Fischer
Browse files

[userspace-rcu] make the userspace-rcu dependecy optional

Disable the userpace-rcu support by default.
Our used userspace-rcu flavor memb is rather new and not available in
liburcu version 0.10 available in debian buster.
This change switches from using DCE and "if constexpr" to the C
preprocessor so the library is only needed when the userspace-rcu support
is actually enabled.
parent 7094703f
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,6 @@
// Non portable.
#include <sched.h> // for cpu_set_t, CPU_SET, CPU_ZERO
#include <sys/sysinfo.h> // for get_nprocs
#include <urcu.h> // for rcu_register_thread
#include <cstdlib> // for rand, srand, abort
#include <cstring>
......@@ -23,9 +22,14 @@
#include "Fiber.hpp" // for Fiber
#include "RuntimeStrategy.hpp" // for RuntimeStrategy
#include "RuntimeStrategyStats.hpp" // for RuntimeStrategyStats
#include "emper-config.h" // IWYU pragma: keep
#include "lib/DebugUtil.hpp"
#include "strategies/ws/WsStrategy.hpp" // for WsStrategy, WsStrategy::INST...
#ifdef EMPER_LIBURCU
#include <urcu.h> // for rcu_register_thread
#endif
#ifndef NDEBUG
#include <syscall.h> // for SYS_gettid
#include <unistd.h> // for syscall
......@@ -79,9 +83,9 @@ Runtime::Runtime(workerid_t workerCount, RuntimeStrategy& strategy, unsigned int
workerIds[i] = i;
auto thread_function = [](void* voidWorkerId) -> void* {
if constexpr (emper::LIBURCU) {
rcu_register_thread();
}
#ifdef EMPER_LIBURCU
rcu_register_thread();
#endif
return currentRuntime->workerLoop(voidWorkerId);
};
......
......@@ -12,14 +12,19 @@ project('EMPER', 'c', 'cpp',
add_project_arguments('-Wno-non-virtual-dtor', language: 'cpp')
thread_dep = dependency('threads')
liburcu_dep = dependency('liburcu')
emper_dependencies = [thread_dep, liburcu_dep]
emper_dependencies = [thread_dep]
run_target('iwyu',
command: 'tools/check-iwyu')
conf_data = configuration_data()
conf_data.set('EMPER_LIBURCU', get_option('userspace-rcu'))
option_urcu = get_option('userspace-rcu')
conf_data.set('EMPER_LIBURCU', option_urcu)
if option_urcu
liburcu_dep = dependency('liburcu')
emper_dependencies += [liburcu_dep]
endif
conf_data.set('EMPER_WORKER_SLEEP', get_option('worker_sleep'))
conf_data.set('EMPER_LOCKED_WS_QUEUE', get_option('locked_ws_queue'))
conf_data.set('EMPER_OVERFLOW_QUEUE', get_option('overflow_queue'))
......
option(
'userspace-rcu',
type: 'boolean',
value: true,
value: false,
description: 'Allow EMPER fibers to use userspace RCU',
)
option(
......
cc = meson.get_compiler('c')
liburcu_memb = cc.find_library('urcu-memb')
liburcu_cds = cc.find_library('urcu-cds')
liburcu_memb = option_urcu ? cc.find_library('urcu-memb') : disabler()
liburcu_cds = option_urcu ? cc.find_library('urcu-cds') : disabler()
tests = {
'SimpleFibTest.cpp':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment