From 3c6382a662bd065953ee7793ad25880654809189 Mon Sep 17 00:00:00 2001 From: Ed Rogalsky Date: Thu, 22 Nov 2012 12:22:19 +0100 Subject: [PATCH] minor code cleanup --- src/jogshuttle.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/jogshuttle.cpp b/src/jogshuttle.cpp index fd321530..0188b166 100644 --- a/src/jogshuttle.cpp +++ b/src/jogshuttle.cpp @@ -31,6 +31,8 @@ #include #include #include +#include +#include #include #define DELAY 10 @@ -114,16 +116,19 @@ void ShuttleThread::run() /* reinit the timeout structure */ timeout.tv_sec = 0; - timeout.tv_usec = 300000; /* 300 ms */ + timeout.tv_usec = 400000; /* 400 ms */ - /* do the select */ + /* do select in blocked mode and wake up after timeout for eval stop_me */ result = select(fd+1, &readset, NULL, NULL, &timeout); - /* see if there was an error or timeout */ + /* see if there was an error or timeout else process event */ if (result < 0) { - // perror("select failed"); + /* usually this is a condition for exit but EINTR error is thrown + * one time when the playback is started the first time. I think + * its ok to ignore this if its not too often */ + kDebug() << strerror(errno) << "\n"; } else if (result == 0) { - //puts("TIMEOUT"); + /* do nothing. reserved for future purposes */ } else { /* we have input */ if (FD_ISSET(fd, &readset)) { @@ -146,7 +151,7 @@ void ShuttleThread::run() /* process event */ handle_event(ev); } else { - fprintf(stderr, "Can't set Jog Shuttle FILE DESCRIPTOR to O_NONBLOCK\n"); + fprintf(stderr, "Can't set Jog Shuttle FILE DESCRIPTOR to O_NONBLOCK and stop thread\n"); stop_me = true; } } -- 2.39.2