Update the test-thread-monitor patch to use std::atomic

tbb::atomic is deprecated and the build otherwise fails with clang.
This commit is contained in:
Timm Bäder 2020-04-27 16:28:36 +02:00
parent 0cbe27892d
commit 491303ecdc
2 changed files with 23 additions and 10 deletions

View File

@ -1,6 +1,14 @@
--- tbb-2019_U8/src/rml/test/test_thread_monitor.cpp.orig 2019-06-06 04:29:15.000000000 -0600 --- tbb-2020.2/oneTBB-2020.2/src/rml/test/test_thread_monitor.cpp 2020-03-30 13:38:06.000000000 +0200
+++ tbb-2019_U8/src/rml/test/test_thread_monitor.cpp 2019-08-27 11:36:44.253575223 -0600 +++ oneTBB-2020.2/src/rml/test/test_thread_monitor.cpp 2020-04-27 15:43:34.209452298 +0200
@@ -33,21 +33,21 @@ public: @@ -23,6 +23,7 @@
#include "thread_monitor.h"
#include "harness_memory.h"
#include "tbb/semaphore.cpp"
+#include <atomic>
class ThreadState {
void loop();
@@ -33,21 +34,21 @@
} }
typedef rml::internal::thread_monitor thread_monitor; typedef rml::internal::thread_monitor thread_monitor;
thread_monitor monitor; thread_monitor monitor;
@ -8,9 +16,9 @@
- volatile int ack; - volatile int ack;
- volatile unsigned clock; - volatile unsigned clock;
- volatile unsigned stamp; - volatile unsigned stamp;
+ tbb::atomic<int> request; + std::atomic<int> request;
+ tbb::atomic<int> ack; + std::atomic<int> ack;
+ tbb::atomic<unsigned> clock; + std::atomic<unsigned> clock;
+ unsigned stamp; + unsigned stamp;
ThreadState() : request(-1), ack(-1), clock(0) {} ThreadState() : request(-1), ack(-1), clock(0) {}
}; };
@ -22,12 +30,13 @@
thread_monitor::cookie c; thread_monitor::cookie c;
monitor.prepare_wait(c); monitor.prepare_wait(c);
if( ack==request ) { if( ack==request ) {
REMARK("%p: request=%d ack=%d\n", this, request, ack ); - REMARK("%p: request=%d ack=%d\n", this, request, ack );
+ REMARK("%p: request=%d ack=%d\n", this, request.load(), ack.load() );
+ ++clock; + ++clock;
monitor.commit_wait(c); monitor.commit_wait(c);
} else } else
monitor.cancel_wait(); monitor.cancel_wait();
@@ -60,7 +60,7 @@ void ThreadState::loop() { @@ -60,7 +61,7 @@
rml::internal::thread_monitor::yield(); rml::internal::thread_monitor::yield();
} }
int r = request; int r = request;
@ -36,7 +45,7 @@
if( !r ) return; if( !r ) return;
} }
} }
@@ -89,7 +89,7 @@ int TestMain () { @@ -89,7 +90,7 @@
REPORT("Warning: thread %d not waiting\n",i); REPORT("Warning: thread %d not waiting\n",i);
break; break;
} }

View File

@ -1,7 +1,7 @@
Name: tbb Name: tbb
Summary: The Threading Building Blocks library abstracts low-level threading details Summary: The Threading Building Blocks library abstracts low-level threading details
Version: 2020.2 Version: 2020.2
Release: 1%{?dist} Release: 2%{?dist}
License: ASL 2.0 License: ASL 2.0
URL: http://threadingbuildingblocks.org/ URL: http://threadingbuildingblocks.org/
@ -197,6 +197,10 @@ rm $RPM_BUILD_ROOT%{_libdir}/cmake/%{name}/README.rst
%{python3_sitearch}/__pycache__/TBB* %{python3_sitearch}/__pycache__/TBB*
%changelog %changelog
* Mon Apr 27 2020 Timm Baeder <tbaeder@redhat.com> - 2020.2-2
- Pass the compiler to when building
- Update the tbb-2019-test-thread-monitor.patch to use std::atomic
* Tue Mar 31 2020 Jerry James <loganjerry@gmail.com> - 2020.2-1 * Tue Mar 31 2020 Jerry James <loganjerry@gmail.com> - 2020.2-1
- Rebase to version 2020.2 - Rebase to version 2020.2