Skip to content

Commit 3714f86

Browse files
committed
Explicit 8MB VICE thread stack size to match Linux default. Fixes https://sourceforge.net/p/vice-emu/bugs/1978/
git-svn-id: https://svn.code.sf.net/p/vice-emu/code/trunk@45895 379a1393-f5fb-40a0-bcee-ef074d9b53f7
1 parent 5d18e29 commit 3714f86

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

vice/src/main.c

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,9 +462,23 @@ int main_program(int argc, char **argv)
462462

463463
#ifdef USE_VICE_THREAD
464464

465-
if (pthread_create(&vice_thread, NULL, vice_thread_main, NULL)) {
466-
log_fatal(main_log, "failed to launch main thread");
467-
return 1;
465+
{
466+
/*
467+
* On macOS, pthreads have a default stack size of 512KB. Linux
468+
* pthreads use 8MB by default. Since we have code in wic64 that
469+
* uses ~1MB temp stack buffers, we explicitly set the VICE thread
470+
* stack size to 8MB to bring all platforms in line with Linux.
471+
*/
472+
473+
pthread_attr_t attr;
474+
size_t stacksize = 8 * 1024 * 1024;
475+
pthread_attr_init(&attr);
476+
pthread_attr_setstacksize(&attr, stacksize);
477+
478+
if (pthread_create(&vice_thread, &attr, vice_thread_main, NULL)) {
479+
log_fatal(main_log, "failed to launch main thread");
480+
return 1;
481+
}
468482
}
469483

470484
pthread_mutex_unlock(&init_lock);

0 commit comments

Comments
 (0)