Example #1
0
void AsioContext::exit(context_idx_t ctx_idx) {
  assert(AsioSession::Get()->getContext(ctx_idx) == this);

  exitContextVector(ctx_idx, m_runnableQueue);
  exitContextVector(ctx_idx, m_fastRunnableQueue);

  for (auto& it : m_priorityQueueDefault) {
    exitContextQueue(ctx_idx, it.second);
  }
  for (auto& it : m_priorityQueueNoPendingIO) {
    exitContextQueue(ctx_idx, it.second);
  }

  exitContextVector(ctx_idx, m_sleepEvents);
  exitContextVector(ctx_idx, m_externalThreadEvents);
}
Example #2
0
void AsioContext::exit(context_idx_t ctx_idx) {
  assert(AsioSession::Get()->getContext(ctx_idx) == this);
  assert(!m_current);

  exitContextQueue(ctx_idx, m_runnableQueue);

  for (auto it : m_priorityQueueDefault) {
    exitContextQueue(ctx_idx, it.second);
  }

  for (auto it : m_priorityQueueNoPendingIO) {
    exitContextQueue(ctx_idx, it.second);
  }

  while (!m_externalThreadEvents.empty()) {
    auto ete_wh = m_externalThreadEvents.back();
    m_externalThreadEvents.pop_back();
    ete_wh->exitContext(ctx_idx);
  }
}