Skip to content

Commit 39b8735

Browse files
committed
unset RCPP_PARALLEL_NUM_THREADS if numThreads = "auto"
Closes #59.
1 parent 624fff1 commit 39b8735

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

R/options.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ setThreadOptions <- function(numThreads = "auto", stackSize = "auto") {
1212

1313
# validate and resolve stackSize
1414
if (identical(stackSize, "auto"))
15-
stackSize = 0L
15+
stackSize <- 0L
1616
else if (!is.numeric(stackSize))
1717
stop("stackSize must be an integer")
1818
else
@@ -24,7 +24,9 @@ setThreadOptions <- function(numThreads = "auto", stackSize = "auto") {
2424
PACKAGE = "RcppParallel"))
2525
}
2626

27-
if (numThreads != -1)
27+
if (numThreads == -1L)
28+
Sys.unsetenv("RCPP_PARALLEL_NUM_THREADS")
29+
else
2830
Sys.setenv(RCPP_PARALLEL_NUM_THREADS = numThreads)
2931
}
3032

0 commit comments

Comments
 (0)