From 5f36bf12f93f480f1f957b884c8f7f69da64648c Mon Sep 17 00:00:00 2001 From: Markus Minichmayr Date: Mon, 10 Oct 2022 19:01:06 +0200 Subject: CMAKE option LIBICAL_SYNC_MODE_THREADLOCAL: Allow compiling all global variables with thread-local storage, thus avoiding the need for synchronization. --- CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index f5d5e52c..c568dd0b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,6 +107,13 @@ # Build with the undefined sanitizer (requires gcc or clang) # Default=false # +# -DLIBICAL_SYNCMODE_THREADLOCAL=[true|false] +# Experimental: If set to true, global variables are marked as thread-local. This allows accessing +# libical from multiple threads without the need for synchronization. However, any global settings +# must be applied per thread. +# If set to false, the default synchronization mechanism is applied. That is, if the pthreads library +# is available, it will be used, otherwise no synchronization is applied. +# Default: false. cmake_minimum_required(VERSION 3.11.0) #first line, to shutup a cygwin warning project(libical C) #CXX is optional for the bindings @@ -736,6 +743,9 @@ if(LIBICAL_DEVMODE_UNDEFINED_SANITIZER) endif() endif() +mark_as_advanced(LIBICAL_SYNCMODE_THREADLOCAL) +libical_option(LIBICAL_SYNCMODE_THREADLOCAL "Experimental: Mark global variables as thread-local." False) + libical_option(ENABLE_LTO_BUILD "Build a link-time optimized version." False) if(ENABLE_LTO_BUILD) if(CMAKE_C_COMPILER_IS_GCC) -- cgit v1.2.1