Skip to content

Commit

Permalink
Added flag for Thread compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
pablogs9 committed Mar 6, 2020
1 parent b7bf2ff commit 7588a06
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
10 changes: 3 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,9 @@ else()
set(time_impl_c src/time_unix.c)
endif()

if(RCUTILS_NO_FILESYSTEM)
add_compile_options(-DRCUTILS_NO_FILESYSTEM=1)
endif()

if(RCUTILS_AVOID_DYNAMIC_ALLOCATION)
add_compile_options(-DRCUTILS_AVOID_DYNAMIC_ALLOCATION=1)
endif()
target_compile_definitions(${PROJECT_NAME} PRIVATE "RCUTILS_NO_FILESYSTEM")
target_compile_definitions(${PROJECT_NAME} PRIVATE "RCUTILS_NO_THREAD_SUPPORT")
target_compile_definitions(${PROJECT_NAME} PRIVATE "RCUTILS_AVOID_DYNAMIC_ALLOCATION")

configure_file (
"${PROJECT_SOURCE_DIR}/include/rcutils/error_handling.h.in"
Expand Down
6 changes: 4 additions & 2 deletions include/rcutils/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ extern "C"

// Note: this block was migrated from rmw/macros.h
// This block either sets RCUTILS_THREAD_LOCAL or RCUTILS_THREAD_LOCAL_PTHREAD.
#if defined _WIN32 || defined __CYGWIN__
#if RCUTILS_NO_THREAD_SUPPORT
#define RCUTILS_THREAD_LOCAL
#elif defined _WIN32 || defined __CYGWIN__
// Windows or Cygwin
#define RCUTILS_THREAD_LOCAL __declspec(thread)
#elif defined __APPLE__
Expand Down Expand Up @@ -57,7 +59,7 @@ extern "C"
#endif
#else
// Some other non-Windows, non-cygwin, non-apple OS
#define RCUTILS_THREAD_LOCAL
#define RCUTILS_THREAD_LOCAL _Thread_local
#endif

#define RCUTILS_STRINGIFY_IMPL(x) #x
Expand Down

0 comments on commit 7588a06

Please sign in to comment.