Skip to content

Commit

Permalink
bump stack size on musl
Browse files Browse the repository at this point in the history
  • Loading branch information
waahm7 committed Jul 23, 2024
1 parent 852f8ce commit 3b10127
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmake/AwsCRuntime.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ function(aws_determine_local_c_runtime target)
if (NOT(${AWS_MUSL_INDEX} EQUAL -1))
message(STATUS "MUSL libc detected")
set(${target} "musl" PARENT_SCOPE)
add_definitions(-DAWS_C_RUNTIME_MUSL)
else()
if ((NOT(${AWS_GLIBC_INDEX} EQUAL -1)) OR (NOT(${AWS_GNU_INDEX} EQUAL -1)))
message(STATUS "Gnu libc detected")
else()
message(STATUS "Could not determine C runtime, defaulting to gnu libc")
endif()
set(${target} "glibc" PARENT_SCOPE)
add_definitions(-DAWS_C_RUNTIME_GLIBC)
endif()
else()
set(${target} "cruntime" PARENT_SCOPE)
Expand Down
16 changes: 16 additions & 0 deletions source/posix/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,22 @@ int aws_thread_launch(
goto cleanup;
}
}
#ifdef AWS_C_RUNTIME_MUSL
if (!options->stack_size) {
size_t stack_size;
attr_return = pthread_attr_getstacksize(&attr, &stack_size);
if (attr_return) {
goto cleanup;
}

if (stack_size < 2 * 1024 * 1024) {
attr_return = pthread_attr_setstacksize(&attr, 2 * 1024 * 1024);
if (attr_return) {
goto cleanup;
}
}
}
#endif

/* AFAIK you can't set thread affinity on apple platforms, and it doesn't really matter since all memory
* NUMA or not is setup in interleave mode.
Expand Down

0 comments on commit 3b10127

Please sign in to comment.