summaryrefslogtreecommitdiffstats
path: root/tdm/kfrontend/sakdlg.cc
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-03-03 15:26:35 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-03-03 15:26:35 -0600
commit5486d8e2a8ed86dc1fa421a46b4e3cd8b796e1ea (patch)
tree3546adc4636298ba339a0fc4cbbe2f89e114f7cd /tdm/kfrontend/sakdlg.cc
parent9e3f8a7f0c9f2ed1125c717f5374aaf8d4ec225e (diff)
downloadtdebase-5486d8e2a8ed86dc1fa421a46b4e3cd8b796e1ea.tar.gz
tdebase-5486d8e2a8ed86dc1fa421a46b4e3cd8b796e1ea.zip
Fix high tdm CPU usage when the SAK is enabled
This closes Bug 690
Diffstat (limited to 'tdm/kfrontend/sakdlg.cc')
-rw-r--r--tdm/kfrontend/sakdlg.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/tdm/kfrontend/sakdlg.cc b/tdm/kfrontend/sakdlg.cc
index 255e36567..b81a1cafa 100644
--- a/tdm/kfrontend/sakdlg.cc
+++ b/tdm/kfrontend/sakdlg.cc
@@ -66,6 +66,7 @@
#include <sys/time.h>
#include <termios.h>
#include <signal.h>
+#include <libgen.h>
#include "kfdialog.h"
@@ -164,6 +165,13 @@ void SAKDlg::handleInputPipe(void) {
umask(0);
struct stat buffer;
int status;
+ char *fifo_parent_dir = strdup(FIFO_DIR);
+ dirname(fifo_parent_dir);
+ status = stat(fifo_parent_dir, &buffer);
+ if (status != 0) {
+ mkdir(fifo_parent_dir, 0644);
+ }
+ free(fifo_parent_dir);
status = stat(FIFO_DIR, &buffer);
if (status == 0) {
int file_mode = ((buffer.st_mode & S_IRWXU) >> 6) * 100;
@@ -187,6 +195,9 @@ void SAKDlg::handleInputPipe(void) {
readbuf[numread] = 0;
readbuf[2047] = 0;
inputcommand += readbuf;
+ if (!tqApp->hasPendingEvents()) {
+ usleep(500);
+ }
tqApp->processEvents();
}
if (closingDown) {