systemc: Add an accessor for getting the current process.
authorGabe Black <gabeblack@google.com>
Tue, 9 Oct 2018 23:21:34 +0000 (16:21 -0700)
committerGabe Black <gabeblack@google.com>
Tue, 16 Oct 2018 01:15:51 +0000 (01:15 +0000)
This is to avoid having to expose the scheduler (which tracks the
current process) to header files which should be independent of gem5
and the underlying implementation.

Change-Id: I1b0810ab66c3ce52b5b94236d7df86da66a62472
Reviewed-on: https://gem5-review.googlesource.com/c/13335
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

src/systemc/core/scheduler.cc
src/systemc/core/scheduler.hh

index 52bf7ec315d440897d43333e546568dfd087e350..5e96a47d57b52aa0fa772001ead9053c1ee7993f 100644 (file)
@@ -457,6 +457,7 @@ Scheduler::trace(bool delta)
 }
 
 Scheduler scheduler;
+Process *getCurrentProcess() { return scheduler.current(); }
 
 namespace {
 
index 14dee2e6f4b067cfd66f04ea16e0e6f2dcc4bfae..2ae03ea1bf254a0586e6024c8f75563987bc0463 100644 (file)
@@ -491,6 +491,9 @@ class Scheduler
 
 extern Scheduler scheduler;
 
+// A proxy function to avoid having to expose the scheduler in header files.
+Process *getCurrentProcess();
+
 inline void
 Scheduler::TimeSlot::process()
 {