summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-08-28 23:32:50 -0700
committerGabe Black <gabeblack@google.com>2018-10-03 00:14:21 +0000
commite1cf6b3e4724850e2ed2ff140efd5f42ed29d212 (patch)
tree0c0ca7ed204b19201ad454c16152c38fa7533001
parentb6ad37a88e95a2efbb118324ef48206ee0b6dbc6 (diff)
downloadgem5-e1cf6b3e4724850e2ed2ff140efd5f42ed29d212.tar.xz
systemc: sc_spawn can create static or dynamic processes.
Their status depends on when sc_spawn is run. Change-Id: I826adf9d5c905687e705642130ca5ad725ce92af Reviewed-on: https://gem5-review.googlesource.com/c/12441 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
-rw-r--r--src/systemc/core/sc_spawn.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/systemc/core/sc_spawn.cc b/src/systemc/core/sc_spawn.cc
index ecb0bbc3f..054feb8da 100644
--- a/src/systemc/core/sc_spawn.cc
+++ b/src/systemc/core/sc_spawn.cc
@@ -31,6 +31,7 @@
#include "systemc/core/process.hh"
#include "systemc/core/process_types.hh"
#include "systemc/core/scheduler.hh"
+#include "systemc/ext/core/sc_main.hh"
#include "systemc/ext/core/sc_module.hh"
#include "systemc/ext/core/sc_spawn.hh"
@@ -59,11 +60,15 @@ spawnWork(ProcessFuncWrapper *func, const char *name,
name = ::sc_core::sc_gen_unique_name("thread_p");
}
+ bool dynamic =
+ (::sc_core::sc_get_status() >
+ ::sc_core::SC_BEFORE_END_OF_ELABORATION);
+
Process *proc;
if (method)
- proc = new Method(name, func, true);
+ proc = new Method(name, func, dynamic);
else
- proc = new Thread(name, func, true);
+ proc = new Thread(name, func, dynamic);
if (opts) {
for (auto e: opts->_events)