Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1fa17ea

Browse filesBrowse files
committed
avoid segfaults with gcc 10.1
1 parent 3f8a0e0 commit 1fa17ea
Copy full SHA for 1fa17ea

File tree

3 files changed

+16
-13
lines changed
Filter options

3 files changed

+16
-13
lines changed

‎DESCRIPTION

Copy file name to clipboardExpand all lines: DESCRIPTION
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: RcppParallel
22
Type: Package
33
Title: Parallel Programming Tools for 'Rcpp'
4-
Version: 5.0.1
4+
Version: 5.0.1-9000
55
Authors@R: c(
66
person("JJ", "Allaire", role = c("aut"), email = "jj@rstudio.com"),
77
person("Romain", "Francois", role = c("aut", "cph")),

‎inst/NEWS

Copy file name to clipboardExpand all lines: inst/NEWS
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
RcppParallel 5.0.2 (UNRELEASED)
2+
------------------------------------------------------------------------
3+
* Subsequent calls to setThreadOptions(...) are now ignored, to avoid
4+
segfaults when compiling RcppParallel / TBB with gcc 10.1.
5+
16
RcppParallel 5.0.1
27
------------------------------------------------------------------------
38
* Fixed compilation issue on OpenSUSE Tumbleweed with -flto=auto

‎src/options.cpp

Copy file name to clipboardExpand all lines: src/options.cpp
+10-12Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,28 @@
1313
extern "C" SEXP setThreadOptions(SEXP numThreadsSEXP, SEXP stackSizeSEXP) {
1414

1515
static tbb::task_scheduler_init* s_pTaskScheduler = NULL;
16+
if (s_pTaskScheduler != NULL)
17+
return Rf_ScalarLogical(0);
1618

1719
int numThreads = Rf_asInteger(numThreadsSEXP);
18-
1920
int stackSize = Rf_asInteger(stackSizeSEXP);
20-
21+
2122
try
2223
{
23-
if (!s_pTaskScheduler) {
24-
s_pTaskScheduler = new tbb::task_scheduler_init(numThreads, stackSize);
25-
} else {
26-
s_pTaskScheduler->terminate();
27-
s_pTaskScheduler->initialize(numThreads, stackSize);
28-
}
24+
s_pTaskScheduler = new tbb::task_scheduler_init(numThreads, stackSize);
2925
}
3026
catch(const std::exception& e)
3127
{
32-
Rf_error(("Error loading TBB: " + std::string(e.what())).c_str());
28+
const char* fmt = "Error loading TBB: %s\n";
29+
Rf_error(fmt, e.what());
3330
}
3431
catch(...)
3532
{
36-
Rf_error("Error loading TBB: (Unknown error)");
33+
const char* fmt = "Error loading TBB: %s\n";
34+
Rf_error(fmt, "(Unknown error)");
3735
}
38-
39-
return R_NilValue;
36+
37+
return Rf_ScalarLogical(1);
4038
}
4139

4240
extern "C" SEXP defaultNumThreads() {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.