summaryrefslogtreecommitdiff
path: root/src/task-worker.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/task-worker.c')
-rw-r--r--src/task-worker.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/task-worker.c b/src/task-worker.c
index 5a50377..37caf1e 100644
--- a/src/task-worker.c
+++ b/src/task-worker.c
@@ -25,6 +25,7 @@
#include "scheduler.h"
#include "task-worker.h"
#include "stats.h"
+#include "ipc.h"
static gboolean sigint_handler(gpointer user_data);
@@ -42,36 +43,45 @@ int main(int argc, char *argv[])
{
if (argc != 3)
{
- DBG("Wrong number of input arguments!");
+ ERR("Wrong number of input arguments!");
return -1;
}
int cfg_size = 0;
- int total_duration = 0;
- data.current_config = deserialize_configs(argv[2], &cfg_size, &total_duration);
+ int task_counter = 0;
+ data.current_config = deserialize_configs(argv[2], &cfg_size, &task_counter);
+ if (task_counter == 0)
+ {
+ ERR("Task counter equals 0");
+ g_free(data.current_config);
+ return -2;
+ }
+
app_provider_init();
- if (!stats_init())
+ ipc_init(argv[1], task_counter);
+ if (stats_init() != 0)
{
ERR("Stats module initialization failed");
g_free(data.current_config);
+ ipc_shutdown();
app_provider_shutdown();
- return -2;
+ return -3;
}
data.scheduler = scheduler_create();
data.main_loop = g_main_loop_new(NULL, true);
g_unix_signal_add(SIGINT, sigint_handler, data.main_loop);
- scheduler_change_config(data.scheduler, data.current_config, cfg_size, total_duration);
+ scheduler_change_config(data.scheduler, data.current_config, cfg_size);
g_main_loop_run(data.main_loop);
g_main_loop_unref(data.main_loop);
- app_provider_shutdown();
scheduler_destroy(data.scheduler);
+ app_provider_shutdown();
+ ipc_shutdown();
g_free(data.current_config);
- DBG("Task-Worker finished!");
return 0;
}