Logo Search packages:      
Sourcecode: ladish version File versions  Download package

bool ladish_app_supervisor_clear ( ladish_app_supervisor_handle  supervisor_handle )

Remove stopped apps; For running apps, initiate stop and mark them as zombies thus causing app autoremove once it quits.

Parameters:
[in]supervisor_handlesupervisor object handle
Returns:
Whether there were no running apps

Definition at line 456 of file app_supervisor.c.

References LADISH_APP_STATE_STOPPING.

{
  struct list_head * node_ptr;
  struct list_head * safe_node_ptr;
  struct ladish_app * app_ptr;
  bool lifeless;

  free(supervisor_ptr->dir);
  supervisor_ptr->dir = NULL;

  free(supervisor_ptr->project_name);
  supervisor_ptr->project_name = NULL;

  lifeless = true;

  list_for_each_safe(node_ptr, safe_node_ptr, &supervisor_ptr->applist)
  {
    app_ptr = list_entry(node_ptr, struct ladish_app, siblings);
    if (app_ptr->pid != 0)
    {
      log_info("terminating '%s'...", app_ptr->name);
      ladish_app_send_signal(app_ptr, SIGTERM, false);
      app_ptr->zombie = true;
      app_ptr->state = LADISH_APP_STATE_STOPPING;
      lifeless = false;
    }
    else
    {
      log_info("removing '%s'", app_ptr->name);
      remove_app_internal(supervisor_ptr, app_ptr);
    }
  }

  return lifeless;
}

Generated by  Doxygen 1.6.0   Back to index