From eb3de78aef9cdb25744edaa5a9601512bb137478 Mon Sep 17 00:00:00 2001
From: MichelJuillard <michel.juillard@mjui.fr>
Date: Sun, 6 Nov 2022 10:33:44 +0100
Subject: [PATCH] clang doesn't support jthread

---
 src/DynareMain.cc | 2 +-
 src/ModelTree.cc  | 4 +++-
 src/ModelTree.hh  | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/DynareMain.cc b/src/DynareMain.cc
index e4bd0efd..d9ba0ccb 100644
--- a/src/DynareMain.cc
+++ b/src/DynareMain.cc
@@ -503,7 +503,7 @@ main(int argc, char **argv)
     }
 
   if (mod_file->use_dll)
-    ModelTree::initializeMEXCompilationWorkers(max(jthread::hardware_concurrency(), 1U));
+    ModelTree::initializeMEXCompilationWorkers(max(thread::hardware_concurrency(), 1U));
 
   if (json == JsonOutputPointType::parsing)
     mod_file->writeJsonOutput(basename, json, json_output_mode, onlyjson);
diff --git a/src/ModelTree.cc b/src/ModelTree.cc
index 9e780a58..9f691dcf 100644
--- a/src/ModelTree.cc
+++ b/src/ModelTree.cc
@@ -45,7 +45,7 @@ condition_variable_any ModelTree::mex_compilation_cv;
 mutex ModelTree::mex_compilation_mut;
 vector<tuple<filesystem::path, set<filesystem::path>, string>> ModelTree::mex_compilation_queue;
 set<filesystem::path> ModelTree::mex_compilation_ongoing, ModelTree::mex_compilation_done, ModelTree::mex_compilation_failed;
-vector<jthread> ModelTree::mex_compilation_workers;
+vector<thread> ModelTree::mex_compilation_workers;
 
 void
 ModelTree::copyHelper(const ModelTree &m)
@@ -1868,6 +1868,7 @@ ModelTree::getRHSFromLHS(expr_t lhs) const
 void
 ModelTree::initializeMEXCompilationWorkers(int numworkers)
 {
+  /*
   assert(numworkers > 0);
   assert(mex_compilation_workers.empty());
 
@@ -1917,6 +1918,7 @@ ModelTree::initializeMEXCompilationWorkers(int numworkers)
             mex_compilation_cv.notify_all();
           }
     });
+*/
 }
 
 void
diff --git a/src/ModelTree.hh b/src/ModelTree.hh
index f7f3394b..bae1a9bd 100644
--- a/src/ModelTree.hh
+++ b/src/ModelTree.hh
@@ -406,7 +406,7 @@ private:
   vector<int> endo2eq;
 
   // Stores workers used for compiling MEX files in parallel
-  static vector<jthread> mex_compilation_workers;
+  static vector<thread> mex_compilation_workers;
 
   /* The following variables implement the thread synchronization mechanism for
      limiting the number of concurrent GCC processes and tracking dependencies
-- 
GitLab