Browse Source

Increase stack size in `examples/threads.c` (#7651)

This commit is an attempt to address the CI failure popping up in #7636.
I can reproduce the failure locally and it appears to be due to the fact
that macOS is giving spawned threads via `pthread_create` a 512K stack
by default. Cranelift when compiled in debug mode is taking more stack
than this (but working in release mode). I was talking with Trevor and
Jamey about possible ways to reduce the stack size here but for now I'm
going with Jamey's suggestion of increasing the stack size as the best
course of action for now.
pull/7654/head
Alex Crichton 11 months ago
committed by GitHub
parent
commit
21c065e3a7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      examples/threads.c

9
examples/threads.c

@ -178,7 +178,14 @@ int main(int argc, const char *argv[]) {
args->engine = engine;
args->module = shared;
printf("Initializing thread %d...\n", i);
pthread_create(&threads[i], NULL, &run, args);
// Guarantee at least 2MB of stack to allow running Cranelift in debug mode
// on CI.
pthread_attr_t attrs;
pthread_attr_init(&attrs);
pthread_attr_setstacksize(&attrs, 2 << 20);
pthread_create(&threads[i], &attrs, &run, args);
pthread_attr_destroy(&attrs);
}
for (int i = 0; i < N_THREADS; i++) {

Loading…
Cancel
Save