From 32be615c0cf52f5fa632b439f4c4dbac5e180412 Mon Sep 17 00:00:00 2001
From: Juan Miguel Carceller <j.m.carcell@cern.ch>
Date: Fri, 20 Oct 2023 14:23:35 +0200
Subject: [PATCH] Support oneTBB

---
 GaudiHive/src/AvalancheSchedulerSvc.cpp | 2 --
 GaudiHive/src/AvalancheSchedulerSvc.h   | 4 ----
 GaudiHive/src/HiveNumbers.h             | 2 +-
 GaudiHive/src/ThreadPoolSvc.cpp         | 4 +---
 4 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/GaudiHive/src/AvalancheSchedulerSvc.cpp b/GaudiHive/src/AvalancheSchedulerSvc.cpp
index 3adad83b77..61994ce983 100644
--- a/GaudiHive/src/AvalancheSchedulerSvc.cpp
+++ b/GaudiHive/src/AvalancheSchedulerSvc.cpp
@@ -34,8 +34,6 @@
 #include "boost/algorithm/string.hpp"
 #include "boost/thread.hpp"
 #include "boost/tokenizer.hpp"
-// DP waiting for the TBB service
-#include "tbb/tbb_stddef.h"
 
 // Instantiation of a static factory class used by clients to create instances of this service
 DECLARE_COMPONENT( AvalancheSchedulerSvc )
diff --git a/GaudiHive/src/AvalancheSchedulerSvc.h b/GaudiHive/src/AvalancheSchedulerSvc.h
index c67440d1fa..ac41828c5b 100644
--- a/GaudiHive/src/AvalancheSchedulerSvc.h
+++ b/GaudiHive/src/AvalancheSchedulerSvc.h
@@ -117,10 +117,6 @@ public:
   /// Constructor
   using extends::extends;
 
-  /// Destructor. Need to enforce noexcept specification as otherwise the noexcept(false) destructor of the
-  /// tbb::task_group member violates the contract
-  ~AvalancheSchedulerSvc() noexcept override {}
-
   /// Initialise
   StatusCode initialize() override;
 
diff --git a/GaudiHive/src/HiveNumbers.h b/GaudiHive/src/HiveNumbers.h
index df025043fd..d10a1dbaa3 100644
--- a/GaudiHive/src/HiveNumbers.h
+++ b/GaudiHive/src/HiveNumbers.h
@@ -33,7 +33,7 @@ class IRndmGenSvc;
 
 namespace HiveRndm {
 
-  typedef tbb::spin_rw_mutex_v3 HiveNumbersMutex;
+  typedef tbb::spin_rw_mutex HiveNumbersMutex;
 
   class GAUDI_API HiveNumbers {
   private:
diff --git a/GaudiHive/src/ThreadPoolSvc.cpp b/GaudiHive/src/ThreadPoolSvc.cpp
index 00ac21c449..a71829658b 100644
--- a/GaudiHive/src/ThreadPoolSvc.cpp
+++ b/GaudiHive/src/ThreadPoolSvc.cpp
@@ -13,8 +13,6 @@
 #include "GaudiKernel/ConcurrencyFlags.h"
 #include "ThreadInitTask.h"
 
-#include "tbb/task_group.h"
-
 #include <chrono>
 #include <thread>
 
@@ -114,7 +112,7 @@ StatusCode ThreadPoolSvc::initPool( const int& poolSize ) {
     Gaudi::Concurrency::ConcurrencyFlags::setNumThreads( m_threadPoolSize );
 
     // Create the task arena to run all algorithms
-    m_arena = tbb::task_arena( m_threadPoolSize + 1 );
+    m_arena.initialize( m_threadPoolSize + 1 );
 
     // Create the barrier for task synchronization at termination
     // (here we increase the number of threads by one to account for calling thread)
-- 
GitLab