1
0
mirror of https://github.com/CPunch/Laika.git synced 2025-09-29 21:20:11 +00:00

Bot: Only run shell task when shell is open

- since the shell task is only ran when the shell is open, i decreased the delta to 50ms. this should improve latancy while improving performance for 99% of the time. yay!
This commit is contained in:
2022-04-14 12:11:29 -05:00
parent 9694ae67d8
commit dac99ddd85
8 changed files with 77 additions and 57 deletions

View File

@@ -9,6 +9,7 @@
#include "lerror.h"
#include "lmem.h"
#include "ltask.h"
#include "bot.h"
#include "shell.h"
@@ -37,6 +38,9 @@ struct sLaika_shell *laikaB_newShell(struct sLaika_bot *bot, int cols, int rows)
LAIKA_ERROR("Failed to set shell fd O_NONBLOCK");
}
/* start shell task */
bot->shellTask = laikaT_newTask(&bot->tService, LAIKA_SHELL_TASK_DELTA, laikaB_shellTask, (void*)bot);
return shell;
}
@@ -47,6 +51,10 @@ void laikaB_freeShell(struct sLaika_bot *bot, struct sLaika_shell *shell) {
bot->shell = NULL;
laikaM_free(shell);
/* stop shell task */
laikaT_delTask(&bot->tService, bot->shellTask);
bot->shellTask = NULL;
}
bool laikaB_readShell(struct sLaika_bot *bot, struct sLaika_shell *shell) {