process.cc (13131:bf07048d69e4) process.cc (13133:41d8cd260825)
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright

--- 146 unchanged lines hidden (view full) ---

155void
156Process::suspend(bool inc_kids)
157{
158 if (inc_kids)
159 forEachKid([](Process *p) { p->suspend(true); });
160
161 if (!_suspended) {
162 _suspended = true;
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright

--- 146 unchanged lines hidden (view full) ---

155void
156Process::suspend(bool inc_kids)
157{
158 if (inc_kids)
159 forEachKid([](Process *p) { p->suspend(true); });
160
161 if (!_suspended) {
162 _suspended = true;
163 _suspendedReady = false;
164 }
163 _suspendedReady = scheduler.suspend(this);
165
164
166 if (procKind() != ::sc_core::SC_METHOD_PROC_ &&
167 scheduler.current() == this) {
168 scheduler.yield();
165 if (procKind() != ::sc_core::SC_METHOD_PROC_ &&
166 scheduler.current() == this) {
167 // This isn't in the spec, but Accellera says that a thread that
168 // self suspends should be marked ready immediately when it's
169 // resumed.
170 _suspendedReady = true;
171 scheduler.yield();
172 }
169 }
170}
171
172void
173Process::resume(bool inc_kids)
174{
175 if (inc_kids)
176 forEachKid([](Process *p) { p->resume(true); });
177
178 if (_suspended) {
179 _suspended = false;
180 if (_suspendedReady)
173 }
174}
175
176void
177Process::resume(bool inc_kids)
178{
179 if (inc_kids)
180 forEachKid([](Process *p) { p->resume(true); });
181
182 if (_suspended) {
183 _suspended = false;
184 if (_suspendedReady)
181 ready();
185 scheduler.resume(this);
182 _suspendedReady = false;
183 }
184}
185
186void
187Process::disable(bool inc_kids)
188{
189 if (inc_kids)

--- 240 unchanged lines hidden ---
186 _suspendedReady = false;
187 }
188}
189
190void
191Process::disable(bool inc_kids)
192{
193 if (inc_kids)

--- 240 unchanged lines hidden ---