Skip to content

Commit

Permalink
refactor(kernel): rename to match
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasanchez committed Apr 21, 2022
1 parent b355f5e commit c403ed8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions kernel/inc/runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ typedef struct context
servidor_t server;
} context_t;

int init(context_t *context);
int on_init(context_t *context);

int run(context_t *context);
int on_run(context_t *context);

void stop(context_t *context, int exit_code);
void on_before_exit(context_t *context, int exit_code);
8 changes: 4 additions & 4 deletions kernel/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ context_t g_context;

int main(void)
{
int exit_code = init(&g_context);
int status_code = on_init(&g_context);

if (exit_code == EXIT_SUCCESS)
exit_code = run(&g_context);
if (status_code == EXIT_SUCCESS)
status_code = on_run(&g_context);

stop(&g_context, exit_code);
on_before_exit(&g_context, status_code);
}
6 changes: 3 additions & 3 deletions kernel/src/runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "runtime.h"
#include "main.h"

int init(context_t *context)
int on_init(context_t *context)
{
if (log_init(MODULE_NAME, true) == ERROR)
return LOG_INITIALIZATION_ERROR;
Expand All @@ -33,7 +33,7 @@ int init(context_t *context)
return EXIT_SUCCESS;
}

int run(context_t *context)
int on_run(context_t *context)
{
if (servidor_escuchar(&(context->server)) == -1)
{
Expand All @@ -49,7 +49,7 @@ int run(context_t *context)
return EXIT_SUCCESS;
}

void stop(context_t *context, int exit_code)
void on_before_exit(context_t *context, int exit_code)
{
LOG_DEBUG("Finalizando ejecucion.\n");

Expand Down
2 changes: 1 addition & 1 deletion kernel/src/signals.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ static void
_sigint()
{
LOG_WARNING("Se capturó la señal SIGINT");
stop(&(g_context), SIGINT);
on_before_exit(&(g_context), SIGINT);
}

static void
Expand Down

0 comments on commit c403ed8

Please sign in to comment.