File tree Expand file tree Collapse file tree 3 files changed +30
-3
lines changed
Expand file tree Collapse file tree 3 files changed +30
-3
lines changed Original file line number Diff line number Diff line change 1414namespace fs = std::filesystem;
1515
1616#include < thread>
17+ #ifdef __APPLE__
18+ #define thread_t std::thread
19+ #else
20+ #define thread_t std::jthread
21+ #endif
1722#include < atomic>
1823
1924std::atomic<unsigned int > progress{0 };
@@ -183,7 +188,7 @@ int main(int argc, char** argv) {
183188 // std::vector<int> deltas;
184189
185190 // lauch progress bar
186- std::jthread t ([]() {
191+ thread_t t ([]() {
187192 while (progress < MAX_TIME && !bExitFlag) {
188193 printLoadingBar (progress, MAX_TIME);
189194 std::this_thread::sleep_for (std::chrono::milliseconds (1500 ));
@@ -299,5 +304,9 @@ int main(int argc, char** argv) {
299304 std::cout << ' \n ' ;
300305 std::cout << " Done." << std::endl;
301306
307+ #ifdef __APPLE__
308+ t.join ();
309+ #endif
310+
302311 return 0 ;
303312}
Original file line number Diff line number Diff line change 1414namespace fs = std::filesystem;
1515
1616#include < thread>
17+ #ifdef __APPLE__
18+ #define thread_t std::thread
19+ #else
20+ #define thread_t std::jthread
21+ #endif
1722#include < atomic>
1823
1924std::atomic<unsigned int > progress{0 };
@@ -287,7 +292,7 @@ int main(int argc, char** argv) {
287292 // std::vector<int> deltas;
288293
289294 // lauch progress bar
290- std::jthread t ([]() {
295+ thread_t t ([]() {
291296 while (progress < MAX_TIME && !bExitFlag) {
292297 printLoadingBar (progress, MAX_TIME);
293298 std::this_thread::sleep_for (std::chrono::milliseconds (1500 ));
@@ -447,5 +452,9 @@ int main(int argc, char** argv) {
447452 std::cout << ' \n ' ;
448453 std::cout << " Done." << std::endl;
449454
455+ #ifdef __APPLE__
456+ t.join ();
457+ #endif
458+
450459 return 0 ;
451460}
Original file line number Diff line number Diff line change 1212#include < string>
1313
1414#include < thread>
15+ #ifdef __APPLE__
16+ #define thread_t std::thread
17+ #else
18+ #define thread_t std::jthread
19+ #endif
1520#include < atomic>
1621
1722std::atomic<unsigned int > progress{0 };
@@ -88,7 +93,7 @@ int main() {
8893 dynamics.updatePaths ();
8994
9095 // lauch progress bar
91- std::jthread t ([MAX_TIME]() {
96+ thread_t t ([MAX_TIME]() {
9297 while (progress < MAX_TIME) {
9398 printLoadingBar (progress, MAX_TIME);
9499 std::this_thread::sleep_for (std::chrono::milliseconds (1500 ));
@@ -113,5 +118,9 @@ int main() {
113118 ++progress;
114119 }
115120
121+ #ifdef __APPLE__
122+ t.join ();
123+ #endif
124+
116125 return 0 ;
117126}
You can’t perform that action at this time.
0 commit comments