Deleted Added
sdiff udiff text old ( 13335:299a16ef8e3c ) new ( 13489:8b0666946c20 )
full compact
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

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

76}
77
78void
79Process::suspend(bool inc_kids)
80{
81 if (inc_kids)
82 forEachKid([](Process *p) { p->suspend(true); });
83
84 if (!_suspended) {
85 _suspended = true;
86 _suspendedReady = scheduler.suspend(this);
87
88 if (procKind() != ::sc_core::SC_METHOD_PROC_ &&
89 scheduler.current() == this) {
90 // This isn't in the spec, but Accellera says that a thread that
91 // self suspends should be marked ready immediately when it's
92 // resumed.

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

97}
98
99void
100Process::resume(bool inc_kids)
101{
102 if (inc_kids)
103 forEachKid([](Process *p) { p->resume(true); });
104
105 if (_suspended) {
106 _suspended = false;
107 if (_suspendedReady)
108 scheduler.resume(this);
109 _suspendedReady = false;
110 }
111}
112
113void

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

119 if (!::sc_core::sc_allow_process_control_corners &&
120 timeoutEvent.scheduled()) {
121 std::string message("attempt to disable a thread with timeout wait: ");
122 message += name();
123 SC_REPORT_ERROR(sc_core::SC_ID_PROCESS_CONTROL_CORNER_CASE_,
124 message.c_str());
125 }
126
127 _disabled = true;
128}
129
130void
131Process::enable(bool inc_kids)
132{
133
134 if (inc_kids)
135 forEachKid([](Process *p) { p->enable(true); });
136
137 _disabled = false;
138}
139
140void
141Process::kill(bool inc_kids)
142{
143 if (::sc_core::sc_get_status() != ::sc_core::SC_RUNNING) {
144 SC_REPORT_ERROR(sc_core::SC_ID_KILL_PROCESS_WHILE_UNITIALIZED_,
145 name());
146 }
147
148 // Propogate the kill to our children no matter what happens to us.
149 if (inc_kids)
150 forEachKid([](Process *p) { p->kill(true); });
151
152 // If we're in the middle of unwinding, ignore the kill request.
153 if (_isUnwinding)
154 return;
155
156 // Update our state.
157 terminate();
158 _isUnwinding = true;
159
160 // Make sure this process isn't marked ready
161 popListNode();

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

172 SC_REPORT_ERROR(sc_core::SC_ID_RESET_PROCESS_WHILE_NOT_RUNNING_,
173 name());
174 }
175
176 // Propogate the reset to our children no matter what happens to us.
177 if (inc_kids)
178 forEachKid([](Process *p) { p->reset(true); });
179
180 // If we're in the middle of unwinding, ignore the reset request.
181 if (_isUnwinding)
182 return;
183
184 // Clear suspended ready since we're about to run regardless.
185 _suspendedReady = false;
186
187 _resetEvent.notify();
188
189 if (_needsStart) {

--- 250 unchanged lines hidden ---