[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdesupport/strigi/src/daemon
From:       Jos van den Oever <jos () vandenoever ! info>
Date:       2008-03-11 0:42:00
Message-ID: 1205196120.464417.22849.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 784356 by vandenoever:

make stopping the daemon more robust

 M  +5 -2      dbus/dbuscpp/dbushandler.cpp  
 M  +2 -2      interface.cpp  


--- trunk/kdesupport/strigi/src/daemon/dbus/dbuscpp/dbushandler.cpp #784355:784356
@@ -105,7 +105,7 @@
     struct timeval tv;
     int max = ((fd>*quitpipe) ?fd :*quitpipe)+1;
     // handle messages in queue
-    while (dbus_connection_dispatch(conn) == DBUS_DISPATCH_DATA_REMAINS) {}
+    //while (dbus_connection_dispatch(conn) == DBUS_DISPATCH_DATA_REMAINS) {}
     while (dbus_connection_get_is_connected(conn)) {
         FD_ZERO(&rfds);
         FD_SET(fd, &rfds);
@@ -114,7 +114,7 @@
         tv.tv_sec = 1000;
         tv.tv_usec = 0;
         retval = select(max, &rfds, NULL, NULL, &tv);
-        if (retval == -1 || FD_ISSET(*quitpipe, &rfds)) { // quit
+        if (retval == -1) {
             break;
         }
         // blocking read of the next available message
@@ -123,6 +123,9 @@
             ;
         }
         dbus_connection_flush(conn);
+        if (FD_ISSET(*quitpipe, &rfds)) { // quit
+            break;
+        }
     }
 
     for (vector<DBusObjectCallHandler*>::const_iterator i=callhandlers.begin();
--- trunk/kdesupport/strigi/src/daemon/interface.cpp #784355:784356
@@ -93,8 +93,8 @@
 }
 string
 Interface::stopDaemon() {
-    cerr << "stopDaemon" << endl;
-    StrigiThread::stopThreads();
+    // send a signal that will stop all threads
+    kill(getpid(), SIGQUIT);
     return "";
 }
 string
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic