From 5486d8e2a8ed86dc1fa421a46b4e3cd8b796e1ea Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 3 Mar 2012 15:26:35 -0600 Subject: Fix high tdm CPU usage when the SAK is enabled This closes Bug 690 --- tdm/kfrontend/kgreeter.cpp | 8 ++++++++ tdm/kfrontend/sakdlg.cc | 11 +++++++++++ 2 files changed, 19 insertions(+) (limited to 'tdm') diff --git a/tdm/kfrontend/kgreeter.cpp b/tdm/kfrontend/kgreeter.cpp index 717d2549f..97c6f2588 100644 --- a/tdm/kfrontend/kgreeter.cpp +++ b/tdm/kfrontend/kgreeter.cpp @@ -83,6 +83,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include #include #include +#include #include @@ -250,6 +251,13 @@ void KGreeter::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; 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 #include #include +#include #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) { -- cgit v1.2.1