norm ok fonctionnement ok leaks ok

This commit is contained in:
hugogogo
2021-09-03 16:45:46 +02:00
parent 5ab8015b2e
commit 2d00b06f1c
10 changed files with 33 additions and 45 deletions

View File

@@ -2,11 +2,11 @@
void send_char(void)
{
if (message.count_bits == 7)
if (g_server.count_bits == 7)
{
ft_putchar(message.character);
message.count_bits = 0;
message.character = 0;
ft_putchar(g_server.character);
g_server.count_bits = 0;
g_server.character = 0;
}
}
@@ -14,8 +14,8 @@ void sig_handler_1(int sig_num, siginfo_t *info, void *context)
{
(void)sig_num;
(void)context;
message.character ^= 1 << (6 - message.count_bits);
message.count_bits++;
g_server.character ^= 1 << (6 - g_server.count_bits);
g_server.count_bits++;
send_char();
kill(info->si_pid, SIGUSR1);
}
@@ -24,16 +24,15 @@ void sig_handler_2(int sig_num, siginfo_t *info, void *context)
{
(void)sig_num;
(void)context;
message.count_bits++;
g_server.count_bits++;
send_char();
kill(info->si_pid, SIGUSR1);
}
void init_message(void)
{
message.count_bits = 0;
message.character = 0;
message.text = ft_strdup("");
g_server.count_bits = 0;
g_server.character = 0;
}
int main(void)
@@ -79,15 +78,6 @@ int main(void)
**
**
** # # # # # # # # # # # # # # # # # # # #
** ressources
**
** use of getpid : https://www.includehelp.com/c/getpid-and-getppid-functions-in-c-linux.aspx
** use of signal : https://linuxhint.com/signal_handlers_c_programming_language
** use of sigaction : https://stackoverflow.com/a/17572787/9497573
** standard signal vs real time signals (with queue option) : https://www.softprayog.in/programming/posix-real-time-signals-in-linux
**
**
** # # # # # # # # # # # # # # # # # # # #
** UNITS PREFIX
**
** times in seconds, deci, centi, milli, micros and nano :