Bon code !

Skip to content
Snippets Groups Projects

Keep the sleep version

Merged Olivier Cartier requested to merge with-sleep into main
1 file
+ 1
1
Compare changes
  • Side-by-side
  • Inline
+ 1
1
@@ -3,7 +3,7 @@
Pass a string of characters from one program to another, using only `kill()` with `SIGUSR1` and `SIGUSR2` (thus passing the data in binary form).
My first work was using usleep, to wait to receive the control bit. It was not working on MacOS (but perfectly on Linux). So I work again to implement the Minitalk whithout using usleep (whithout global variable too). It wasn't working on MacOS...
But after a long research time I was able to make my Minitalk work on MacOS by using the **sa_flags** `SA_SIGINFO | SA_RESTART | SA_NODEFER` instead of `SA_SIGINFO`. So my two implementation are perfectly working, and I kept the one whithout sleep for performances reasons. My work with sleep still exist on the `with-sleep` branch.
But after a long research time I was able to make my Minitalk work on MacOS by using the **sa_flags** `SA_SIGINFO | SA_RESTART | SA_NODEFER` instead of `SA_SIGINFO`. So my two implementation are perfectly working, and I kept the one with sleep. My work whithout sleep still exist on the `nosleep` branch.
The subject asked to pass a string of 100 characters in less than 1 second, my program does it in 0.015 seconds (I flex a little).
Loading