summaryrefslogtreecommitdiff
path: root/src/systemc/ext
diff options
context:
space:
mode:
Diffstat (limited to 'src/systemc/ext')
-rw-r--r--src/systemc/ext/core/sc_join.hh8
-rw-r--r--src/systemc/ext/core/sc_spawn.hh16
2 files changed, 21 insertions, 3 deletions
diff --git a/src/systemc/ext/core/sc_join.hh b/src/systemc/ext/core/sc_join.hh
index 18119ae3d..49e54ceee 100644
--- a/src/systemc/ext/core/sc_join.hh
+++ b/src/systemc/ext/core/sc_join.hh
@@ -30,6 +30,7 @@
#ifndef __SYSTEMC_EXT_CORE_SC_JOIN_HH__
#define __SYSTEMC_EXT_CORE_SC_JOIN_HH__
+#include "sc_event.hh"
#include "sc_process_handle.hh"
namespace sc_core
@@ -43,11 +44,16 @@ class sc_join
{
public:
sc_join();
+
void add_process(sc_process_handle);
int process_count();
- virtual void signal(sc_thread_handle thread_p, int type);
+ void signal();
void wait();
void wait_clocked();
+
+ private:
+ sc_event joinEvent;
+ int remaining;
};
} // namespace sc_core
diff --git a/src/systemc/ext/core/sc_spawn.hh b/src/systemc/ext/core/sc_spawn.hh
index 82851542d..d97883035 100644
--- a/src/systemc/ext/core/sc_spawn.hh
+++ b/src/systemc/ext/core/sc_spawn.hh
@@ -32,6 +32,7 @@
#include <vector>
+#include "sc_join.hh"
#include "sc_process_handle.hh"
namespace sc_core
@@ -166,11 +167,22 @@ sc_spawn(typename T::result_type *r_p, T object, const char *name_p=nullptr,
::sc_core::sc_process_handle forkees[] = {
#define SC_JOIN \
- }; /* TODO wait for the forkees. */ \
+ }; \
+ ::sc_core::sc_join join; \
+ for (int i = 0; i < sizeof(forkees) / sizeof(forkees[0]); i++) \
+ join.add_process(forkees[i]); \
+ join.wait(); \
}
// Non-standard
-#define SC_CJOIN SC_JOIN
+#define SC_CJOIN \
+ }; \
+ ::sc_core::sc_join join; \
+ for (int i = 0; i < sizeof(forkees) / sizeof(forkees[0]); i++) \
+ join.add_process(forkees[i]); \
+ join.wait_clocked(); \
+}
+
} // namespace sc_core