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

bool ladish_app_supervisor_child_exit ( ladish_app_supervisor_handle  supervisor_handle,
pid_t  pid 
)

Mark that app has quit

This function is called to mark that app has quit. Must not be called from signal handler because app supervisor object is not thread safe.

Parameters:
[in]supervisor_handlesupervisor object handle
[in]pidof the app whose termination was detected

Definition at line 551 of file app_supervisor.c.

References LADISH_APP_STATE_STARTED, and LADISH_APP_STATE_STOPPED.

{
  struct list_head * node_ptr;
  struct ladish_app * app_ptr;

  list_for_each(node_ptr, &supervisor_ptr->applist)
  {
    app_ptr = list_entry(node_ptr, struct ladish_app, siblings);
    if (app_ptr->pid == pid)
    {
      log_info("exit of child '%s' detected.", app_ptr->name);

      app_ptr->pid = 0;
      app_ptr->pgrp = 0;
      /* firstborn pid and pgrp is not reset here because it is refcounted
         and managed independently through the add/del_pid() methods */

      if (app_ptr->zombie)
      {
        remove_app_internal(supervisor_ptr, app_ptr);
      }
      else
      {
        if (app_ptr->state == LADISH_APP_STATE_STARTED)
        {
          ladish_notify_simple(LADISH_NOTIFY_URGENCY_HIGH, "App terminated unexpectedly", app_ptr->name);
        }

        app_ptr->state = LADISH_APP_STATE_STOPPED;

        emit_app_state_changed(supervisor_ptr, app_ptr);
      }

      return true;
    }
  }

  return false;
}

Generated by  Doxygen 1.6.0   Back to index