Skip to content

Commit

Permalink
provide back-compat class defn
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinushey committed Jan 16, 2025
1 parent f2f9dc1 commit 4dff28c
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
^\.Rprofile$
^\.Rproj\.user$
^appveyor\.yml$
^check$
^doc$
^gen$
^libs$
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.Rhistory
.RData
.DS_Store
check
inst/doc
inst/lib
inst/libs
Expand Down
7 changes: 3 additions & 4 deletions inst/include/RcppParallel.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@
#endif

#if RCPP_PARALLEL_USE_TBB
#if defined(WINNT) && defined(__aarch64__) && !defined(TBB_USE_GCC_BUILTINS)
#define TBB_USE_GCC_BUILTINS 1
#endif
# if defined(WINNT) && defined(__aarch64__) && !defined(TBB_USE_GCC_BUILTINS)
# define TBB_USE_GCC_BUILTINS 1
# endif
# include "RcppParallel/TBB.h"
#endif

#include "RcppParallel/Backend.h"

#include "RcppParallel/RVector.h"
#include "RcppParallel/RMatrix.h"

Expand Down
31 changes: 31 additions & 0 deletions inst/include/RcppParallel/TBB.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,37 @@
#include <tbb/tbb.h>
#include <tbb/global_control.h>
#include <tbb/scalable_allocator.h>
#include <tbb/task_arena.h>

// For compatibility with older R packages.
namespace tbb {

#ifndef __TBB_task_scheduler_init_H
#define __TBB_task_scheduler_init_H

class task_scheduler_init {

public:
task_scheduler_init(
int number_of_threads = -1,
std::size_t stack_size = 0)
{
}

static int default_num_threads()
{
return tbb::this_task_arena::max_concurrency();
}

static const int automatic = -1;
static const int deferred = -2;

};

#endif

} // end namespace tbb


namespace RcppParallel {

Expand Down

0 comments on commit 4dff28c

Please sign in to comment.