Skip to content
Snippets Groups Projects
Commit df920bc5 authored by Marek Vavrusa's avatar Marek Vavrusa
Browse files

SIGALRM as notification/interrupt signal and UNUSED(param) macro.

parent f4474407
Branches
Tags
No related merge requests found
......@@ -20,4 +20,7 @@ typedef unsigned int uint;
*/
#define ERR_ALLOC_FAILED log_error("Allocation failed at %s:%d (%s ver.%x)\n", __FILE__, __LINE__, PROJECT_NAME, PROJECT_VER)
/* Eliminate compiler warning with unused parameters. */
#define UNUSED(param) (param) = (param)
#endif // COMMON
......@@ -15,8 +15,9 @@ static cute_server* s_server = NULL;
void interrupt_handle(int s)
{
// Invalid input
if(s != SIGINT || s_server == NULL)
if(s != SIGINT || s_server == NULL) {
return;
}
// Stop server
if(s_stopping == 0) {
......@@ -53,6 +54,7 @@ int main( int argc, char **argv )
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
sigaction(SIGINT, &sa, NULL);
sigaction(SIGALRM, &sa, NULL); // Notification/Interrupt
// Run server
if ((res = cute_start(s_server, argv + 1, argc - 1)) != 0) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment