summaryrefslogtreecommitdiff
path: root/src/systemc/core/process.cc
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-08-30 00:39:49 -0700
committerGabe Black <gabeblack@google.com>2018-10-03 00:16:46 +0000
commitf6fda869ead3aae97e73d2222bfc9fdfd837491e (patch)
tree50b3364b03399c03b06c6a04122da327fb744104 /src/systemc/core/process.cc
parent420ab42e02e2a7c0c5aace5b330717cc014bd178 (diff)
downloadgem5-f6fda869ead3aae97e73d2222bfc9fdfd837491e.tar.xz
systemc: Keep track of more cases when we should be ready after resume.
If a thread self suspends, it should be marked as ready after resuming. If a process was already ready when suspended, it should also be remarked as ready after resuming. Special care has to be taken in pre-initialization situations so that processes are put on the right lists, and whether a process is tracked is already marked as ready. Change-Id: I15da7d747db591785358d47781297468c5f9fd09 Reviewed-on: https://gem5-review.googlesource.com/c/12445 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/systemc/core/process.cc')
-rw-r--r--src/systemc/core/process.cc18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/systemc/core/process.cc b/src/systemc/core/process.cc
index 830b8c729..1fd16e0d9 100644
--- a/src/systemc/core/process.cc
+++ b/src/systemc/core/process.cc
@@ -160,12 +160,16 @@ Process::suspend(bool inc_kids)
if (!_suspended) {
_suspended = true;
- _suspendedReady = false;
- }
-
- if (procKind() != ::sc_core::SC_METHOD_PROC_ &&
- scheduler.current() == this) {
- scheduler.yield();
+ _suspendedReady = scheduler.suspend(this);
+
+ if (procKind() != ::sc_core::SC_METHOD_PROC_ &&
+ scheduler.current() == this) {
+ // This isn't in the spec, but Accellera says that a thread that
+ // self suspends should be marked ready immediately when it's
+ // resumed.
+ _suspendedReady = true;
+ scheduler.yield();
+ }
}
}
@@ -178,7 +182,7 @@ Process::resume(bool inc_kids)
if (_suspended) {
_suspended = false;
if (_suspendedReady)
- ready();
+ scheduler.resume(this);
_suspendedReady = false;
}
}