got rid of usleep, changed to pause()

This commit is contained in:
Dhanya Maliakal 2017-09-19 16:32:15 +02:00
parent c37d3feae9
commit 41db424837

View File

@ -14,6 +14,7 @@
#include <sys/types.h> //wait #include <sys/types.h> //wait
#include <sys/wait.h> //wait #include <sys/wait.h> //wait
#include <unistd.h> //usleep
#include <syscall.h> #include <syscall.h>
using namespace std; using namespace std;
@ -78,7 +79,7 @@ int main(int argc, char *argv[]) {
asa.sa_handler=SIG_IGN; // handler function asa.sa_handler=SIG_IGN; // handler function
sigemptyset(&asa.sa_mask); // dont block additional signals during invocation of handler sigemptyset(&asa.sa_mask); // dont block additional signals during invocation of handler
if (sigaction(SIGPIPE, &asa, NULL) == -1) { if (sigaction(SIGPIPE, &asa, NULL) == -1) {
bprintf(RED, "Could not set handler function for SIGCHILD\n"); bprintf(RED, "Could not set handler function for SIGPIPE\n");
} }
@ -142,7 +143,7 @@ int main(int argc, char *argv[]) {
FILE_LOG(logINFO) << "Ready ... "; FILE_LOG(logINFO) << "Ready ... ";
bprintf(GRAY, "\n[ Press \'Ctrl+c\' to exit ]\n"); bprintf(GRAY, "\n[ Press \'Ctrl+c\' to exit ]\n");
while(keeprunning) while(keeprunning)
usleep(5 * 1000 * 1000); pause();
delete receiver; delete receiver;
bprintf(BLUE,"Exiting [ Tid: %ld ]\n", (long)syscall(SYS_gettid)); bprintf(BLUE,"Exiting [ Tid: %ld ]\n", (long)syscall(SYS_gettid));