summaryrefslogtreecommitdiff
path: root/src/systemc/ext/core/sc_spawn.hh
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-09-10 22:01:47 -0700
committerGabe Black <gabeblack@google.com>2018-10-09 21:45:46 +0000
commit960c3500532a0ca28e4192f838e81eeb7c29860c (patch)
treed69f9fca16de85245c1be592c64f54bc186e958d /src/systemc/ext/core/sc_spawn.hh
parentc8d3cb5fadfac8ad90fd81edc707d83051b275da (diff)
downloadgem5-960c3500532a0ca28e4192f838e81eeb7c29860c.tar.xz
systemc: Implement SC_FORK, SC_JOIN, and SC_CJOIN.
SC_CJOIN is non-standard, but relied on by the Accellera tests. Change-Id: Ia4ddcb1749a07891157a58398137e94fcaa8e815 Reviewed-on: https://gem5-review.googlesource.com/c/12615 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/systemc/ext/core/sc_spawn.hh')
-rw-r--r--src/systemc/ext/core/sc_spawn.hh16
1 files changed, 14 insertions, 2 deletions
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