Exemplo n.º 1
0
void Thread::Dealloc() {
  AssertNoncritical();
  
  // destroy all the ports on this thread
  for (int i = 0; i < portList.GetMap().GetBucketCount(); ++i) {
    auto & bucket = portList.GetMap().GetBucket(i);
    for (auto j = bucket.GetStart(); j != bucket.GetEnd(); ++j) {
      ThreadPort & p = *j;
      p.Sever();
      p.Dealloc(false);
    }
  }
  
  if (inScheduler) {
    GetTask().GetScheduler().Remove(*this);
  }
  if (killed) {
    if (inTask) {
      GetTask().GetThreadList().Remove(*this);
    }
    GetTask().Release();
  }
  
  delete this;
}
Exemplo n.º 2
0
void * operator new(size_t s) {
  AssertNoncritical();
  void * result;
  if (!anarch::Domain::GetCurrent().Alloc(result, s)) {
    return NULL;
  }
  return result;
}
Exemplo n.º 3
0
void GarbageCollector::Main() {
  AssertNoncritical();
  while (1) {
    anarch::SetCritical(true);
    objectsLock.Seize();
    GarbageObject * obj = objects.Shift();
    if (!obj) {
      scheduler.SetInfiniteTimeout(objectsLock);
      anarch::SetCritical(false);
    } else {
      objectsLock.Release();
      anarch::SetCritical(false);
      obj->Dealloc();
    }
  }
}
Exemplo n.º 4
0
void NoncriticalLock::SeizeYielding() {
  AssertNoncritical();
  super::SeizeYielding();
}
Exemplo n.º 5
0
void NoncriticalLock::Release() {
  AssertNoncritical();
  super::Release();
}
Exemplo n.º 6
0
void NoncriticalLock::Seize() {
  AssertNoncritical();
  super::Seize();
}
Exemplo n.º 7
0
Terminal & Terminal::New(Port * p, GarbageCollector & c) {
  AssertNoncritical();
  Terminal * t = new Terminal(p, c);
  assert(t != NULL);
  return *t;
}
Exemplo n.º 8
0
void Terminal::Hangup() {
  AssertNoncritical();
  if (connection) {
    connection->Close(*this);
  }
}
Exemplo n.º 9
0
void Terminal::Dealloc() {
  AssertNoncritical();
  Hangup();
  delete this;
}
Exemplo n.º 10
0
KernelTask & KernelTask::New(Scheduler & s) {
  AssertNoncritical();
  KernelTask * t = new KernelTask(s);
  assert(t != NULL);
  return *t;
}
Exemplo n.º 11
0
Thread & Thread::New(Task & t, anarch::State & s) {
  AssertNoncritical();
  Thread * result = new Thread(t, s);
  assert(result != NULL);
  return *result;
}
Exemplo n.º 12
0
void operator delete[](void * p) {
  AssertNoncritical();
  anarch::Domain::GetCurrent().Free(p);
}
Exemplo n.º 13
0
void Hpet::Stop() {
  AssertNoncritical();
  ScopedCritical critical;
  volatile uint64_t * regs = (volatile uint64_t *)map.GetStart();
  regs[2] &= ~(uint64_t)1;
}