Skip to content

Commit 29717f2

Browse files
Remove ambiguity and TSAN errors in async_suspend example
Signed-off-by: Mark Burton <mburton@quicinc.com>
1 parent 946dccf commit 29717f2

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

examples/sysc/async_suspend/collector.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class collector
5454

5555
void csvreport()
5656
{
57+
std::lock_guard<std::mutex> guard(lock);
5758
cout << "event";
5859
for (auto kv : names)
5960
{

examples/sysc/async_suspend/node.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include <mutex>
3737
#include <thread>
3838
#include <condition_variable>
39+
#include <atomic>
3940

4041
#include "tlm.h"
4142
#include "tlm_utils/simple_initiator_socket.h"
@@ -110,8 +111,8 @@ SC_MODULE (asynctestnode)
110111
collector &col; // just used to print out the results
111112

112113

113-
bool running;
114-
bool finished;
114+
std::atomic<bool> running;
115+
std::atomic<bool> finished;
115116

116117
asynctestnode(sc_core::sc_module_name name, collector &c) :
117118
init_socket("output"),

0 commit comments

Comments
 (0)