daemon: on studio stop, wait apps to finish before stopping jack server. Fix for #24
This commit is contained in:
parent
27c9709164
commit
58be0887f5
|
@ -28,9 +28,11 @@
|
||||||
|
|
||||||
#include "cmd.h"
|
#include "cmd.h"
|
||||||
#include "studio_internal.h"
|
#include "studio_internal.h"
|
||||||
|
#include "loader.h"
|
||||||
|
|
||||||
#define STOP_STATE_WAITING_FOR_JACK_CLIENTS_DISAPPEAR 1
|
#define STOP_STATE_WAITING_FOR_JACK_CLIENTS_DISAPPEAR 1
|
||||||
#define STOP_STATE_WAITING_FOR_JACK_SERVER_STOP 2
|
#define STOP_STATE_WAITING_FOR_CHILDS_TERMINATION 2
|
||||||
|
#define STOP_STATE_WAITING_FOR_JACK_SERVER_STOP 3
|
||||||
|
|
||||||
struct ladish_command_stop_studio
|
struct ladish_command_stop_studio
|
||||||
{
|
{
|
||||||
|
@ -75,6 +77,18 @@ static bool run(void * context)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmd_ptr->stop_state = STOP_STATE_WAITING_FOR_CHILDS_TERMINATION;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cmd_ptr->stop_state == STOP_STATE_WAITING_FOR_CHILDS_TERMINATION)
|
||||||
|
{
|
||||||
|
clients_count = loader_get_app_count();
|
||||||
|
log_info("%u child processes are running", clients_count);
|
||||||
|
if (clients_count != 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
log_info("Stopping JACK server...");
|
log_info("Stopping JACK server...");
|
||||||
|
|
||||||
ladish_graph_dump(g_studio.studio_graph);
|
ladish_graph_dump(g_studio.studio_graph);
|
||||||
|
|
|
@ -564,3 +564,18 @@ free_struct:
|
||||||
fail:
|
fail:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int loader_get_app_count(void)
|
||||||
|
{
|
||||||
|
struct list_head * node_ptr;
|
||||||
|
unsigned int count;
|
||||||
|
|
||||||
|
count = 0;
|
||||||
|
|
||||||
|
list_for_each(node_ptr, &g_childs_list)
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
|
@ -42,4 +42,6 @@ void loader_run(void);
|
||||||
|
|
||||||
void loader_uninit(void);
|
void loader_uninit(void);
|
||||||
|
|
||||||
|
unsigned int loader_get_app_count(void);
|
||||||
|
|
||||||
#endif /* __LASHD_LOADER_H__ */
|
#endif /* __LASHD_LOADER_H__ */
|
||||||
|
|
Loading…
Reference in New Issue