;
}
-ThreadContext *
-Process::findFreeContext()
-{
- for (auto &it : system->threadContexts) {
- if (ThreadContext::Halted == it->status())
- return it;
- }
- return nullptr;
-}
-
void
Process::revokeThreadContext(int context_id)
{
contextIds.push_back(context_id);
}
- // Find a free context to use
- ThreadContext *findFreeContext();
-
/**
* After delegating a thread context to a child process
* no longer should relate to the ThreadContext
return -EINVAL;
ThreadContext *ctc;
- if (!(ctc = p->findFreeContext())) {
+ if (!(ctc = tc->getSystemPtr()->findFreeContext())) {
DPRINTF_SYSCALL(Verbose, "clone: no spare thread context in system"
"[cpu %d, thread %d]", tc->cpuId(), tc->threadId());
return -EAGAIN;
return id;
}
+ThreadContext *
+System::findFreeContext()
+{
+ for (auto &it : threadContexts) {
+ if (ThreadContext::Halted == it->status())
+ return it;
+ }
+ return nullptr;
+}
+
bool
System::schedule(PCEvent *event)
{
unsigned int cacheLineSize() const { return _cacheLineSize; }
std::vector<ThreadContext *> threadContexts;
+ ThreadContext *findFreeContext();
+
+ ThreadContext *
+ getThreadContext(ContextID tid) const
+ {
+ return threadContexts[tid];
+ }
+
const bool multiThread;
using SimObject::schedule;
bool schedule(PCEvent *event) override;
bool remove(PCEvent *event) override;
- ThreadContext *getThreadContext(ContextID tid) const
- {
- return threadContexts[tid];
- }
-
unsigned numContexts() const { return threadContexts.size(); }
/** Return number of running (non-halted) thread contexts in