Skip to content

Commit 860bbc5

Browse files
default to 0 if generating output
1 parent 6f174d1 commit 860bbc5

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/jloptions.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,8 +624,11 @@ JL_DLLEXPORT void jl_parse_opts(int *argcp, char ***argvp)
624624
case 't': // threads
625625
errno = 0;
626626
jl_options.nthreadpools = 2;
627-
// By default, main threads = -1 (== "auto"), interactive = 1
628-
long nthreads = -1, nthreadsi = 1;
627+
// By default:
628+
// default threads = -1 (== "auto")
629+
long nthreads = -1;
630+
// interactive threads = 1, or 0 if generating output
631+
long nthreadsi jl_generating_output() ? 0 : 1;
629632

630633
if (!strncmp(optarg, "auto", 4)) {
631634
jl_options.nthreads = -1;

src/threading.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,8 @@ void jl_init_threading(void)
698698
// and `jl_n_threads_per_pool`.
699699
jl_n_threadpools = 2;
700700
int16_t nthreads = JULIA_NUM_THREADS;
701-
int16_t nthreadsi = 1;
701+
// if generating output default to 0 interactive threads, otherwise default to 1
702+
int16_t nthreadsi = jl_generating_output() ? 0 : 1;
702703
char *endptr, *endptri;
703704

704705
if (jl_options.nthreads != 0) { // --threads specified

0 commit comments

Comments
 (0)