예제 #1
0
static void ponyint_sched_shutdown()
{
  uint32_t start;

  start = 0;

  for(uint32_t i = start; i < scheduler_count; i++)
    ponyint_thread_join(scheduler[i].tid);

  DTRACE0(RT_END);
  ponyint_cycle_terminate(&scheduler[0].ctx);

  for(uint32_t i = 0; i < scheduler_count; i++)
  {
    while(ponyint_messageq_pop(&scheduler[i].mq) != NULL);
    ponyint_messageq_destroy(&scheduler[i].mq);
    ponyint_mpmcq_destroy(&scheduler[i].q);
  }

  ponyint_pool_free_size(scheduler_count * sizeof(scheduler_t), scheduler);
  scheduler = NULL;
  scheduler_count = 0;

  ponyint_mpmcq_destroy(&inject);
}
예제 #2
0
파일: asio.c 프로젝트: Perelandric/ponyc
bool ponyint_asio_stop()
{
  if(atomic_load_explicit(&running_base.noisy_count, memory_order_relaxed) > 0)
    return false;

  if(running_base.backend != NULL)
  {
    ponyint_asio_backend_final(running_base.backend);
    ponyint_thread_join(running_base.tid);

    running_base.backend = NULL;
    running_base.tid = 0;
  }

  return true;
}