Skip to content

Commit a226a73

Browse files
Only default to fastcontext on architectures where it's been confirmed to work.
1 parent 1a74e0d commit a226a73

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/CMakeLists.txt

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,25 @@ set(QTHREADS_DEFAULT_STACK_SIZE 32768 CACHE STRING "Default qthread stack size."
88
set(QTHREADS_HASHMAP hashmap CACHE STRING "Which hashmap implementation to use. Valid values are \"hashmap\" and \"lf_hashmap\".")
99
set(QTHREADS_DICT_TYPE shavit CACHE STRING "Which dictionary implementation to use. Valid values are \"shavit\", \"trie\", and \"simple\".")
1010
set(QTHREADS_TIMER_TYPE gettimeofday CACHE STRING "Which timer implementation to use. Valid values are \"clock_gettime\", \"mach\", \"gettimeofday\", and \"gethrtime\".")
11-
set(QTHREADS_CONTEXT_SWAP_IMPL fastcontext CACHE STRING "Which context swap implementation to use. Valid values are \"system\" and \"fastcontext\".")
11+
# Only default to the fastcontext implementation in cases where it's confirmed to work.
12+
# Note: apparently 32-bit x86 may show up as i386, i486, i586, or i686.
13+
# Little-endian powerpc variants are excluded here as they're known not to work
14+
# due to an unresolved bug in our fastcontext code.
15+
if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64" OR
16+
"${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "amd64" OR
17+
"${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64" OR
18+
"${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm64" OR
19+
"${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm" OR
20+
"${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i386" OR
21+
"${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i486" OR
22+
"${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i586" OR
23+
"${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686" OR
24+
"${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "ppc64" OR
25+
"${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "ppc")
26+
set(QTHREADS_CONTEXT_SWAP_IMPL fastcontext CACHE STRING "Which context swap implementation to use. Valid values are \"system\" and \"fastcontext\".")
27+
else()
28+
set(QTHREADS_CONTEXT_SWAP_IMPL system CACHE STRING "Which context swap implementation to use. Valid values are \"system\" and \"fastcontext\".")
29+
endif()
1230
set(QTHREADS_HWLOC_GET_TOPOLOGY_FUNCTION "" CACHE STRING "function to get hwloc topology (otherwise uses hwloc_topology_init and hwloc_topology_load)")
1331
set(QTHREADS_GUARD_PAGES OFF CACHE BOOL "Whether or not to guard memory pages to help with debugging stack overflows. Default is OFF.")
1432
set(QTHREADS_CONDWAIT_QUEUE OFF CACHE BOOL "Use a waiting queue based on pthread condition variables instead of a spin-based queue for inter-thread communication. Default is OFF.")

0 commit comments

Comments
 (0)