Skip to content

Commit 4dff28c

Browse files
committed
provide back-compat class defn
1 parent f2f9dc1 commit 4dff28c

File tree

4 files changed

+36
-4
lines changed

4 files changed

+36
-4
lines changed

.Rbuildignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
^\.Rprofile$
55
^\.Rproj\.user$
66
^appveyor\.yml$
7+
^check$
78
^doc$
89
^gen$
910
^libs$

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
.Rhistory
44
.RData
55
.DS_Store
6+
check
67
inst/doc
78
inst/lib
89
inst/libs

inst/include/RcppParallel.h

+3-4
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,13 @@
1818
#endif
1919

2020
#if RCPP_PARALLEL_USE_TBB
21-
#if defined(WINNT) && defined(__aarch64__) && !defined(TBB_USE_GCC_BUILTINS)
22-
#define TBB_USE_GCC_BUILTINS 1
23-
#endif
21+
# if defined(WINNT) && defined(__aarch64__) && !defined(TBB_USE_GCC_BUILTINS)
22+
# define TBB_USE_GCC_BUILTINS 1
23+
# endif
2424
# include "RcppParallel/TBB.h"
2525
#endif
2626

2727
#include "RcppParallel/Backend.h"
28-
2928
#include "RcppParallel/RVector.h"
3029
#include "RcppParallel/RMatrix.h"
3130

inst/include/RcppParallel/TBB.h

+31
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,37 @@
1010
#include <tbb/tbb.h>
1111
#include <tbb/global_control.h>
1212
#include <tbb/scalable_allocator.h>
13+
#include <tbb/task_arena.h>
14+
15+
// For compatibility with older R packages.
16+
namespace tbb {
17+
18+
#ifndef __TBB_task_scheduler_init_H
19+
#define __TBB_task_scheduler_init_H
20+
21+
class task_scheduler_init {
22+
23+
public:
24+
task_scheduler_init(
25+
int number_of_threads = -1,
26+
std::size_t stack_size = 0)
27+
{
28+
}
29+
30+
static int default_num_threads()
31+
{
32+
return tbb::this_task_arena::max_concurrency();
33+
}
34+
35+
static const int automatic = -1;
36+
static const int deferred = -2;
37+
38+
};
39+
40+
#endif
41+
42+
} // end namespace tbb
43+
1344

1445
namespace RcppParallel {
1546

0 commit comments

Comments
 (0)