[Marble-commits] branches/KDE/4.4/kdeedu/marble/src/plugins/positionprovider/gpsd

Dennis Nienhüser earthwings at gentoo.org
Wed Apr 28 21:40:23 CEST 2010


SVN commit 1120292 by nienhueser:

Use a non-blocking call to determine if data is available to avoid that the thread cannot be terminated properly when it's blocked by gpsd. Backport of commit 1120287.
CCBUG: 234311


 M  +7 -5      GpsdConnection.cpp  
 M  +4 -6      GpsdPositionProviderPlugin.cpp  


--- branches/KDE/4.4/kdeedu/marble/src/plugins/positionprovider/gpsd/GpsdConnection.cpp #1120291:1120292
@@ -31,16 +31,18 @@
 
 void GpsdConnection::update()
 {
-    gps_data_t* data = 0;
 #if defined( GPSD_API_MAJOR_VERSION ) && ( GPSD_API_MAJOR_VERSION >= 3 ) && defined( PACKET_SET )
-    while ((data = m_gpsd.poll()) && !(data->set & PACKET_SET)) {
-        data = m_gpsd.poll();
+    if ( m_gpsd.waiting() ) {
+        gps_data_t* data = m_gpsd.poll();
+        if ( data && data->set & PACKET_SET ) {
+            emit gpsdInfo( *data );
     }
+    }
 #else
-    data = m_gpsd.query( "o" );
-#endif
+    gps_data_t* data = m_gpsd.query( "o" );
     if ( data )
         emit gpsdInfo( *data );
+#endif
 }
 
 
--- branches/KDE/4.4/kdeedu/marble/src/plugins/positionprovider/gpsd/GpsdPositionProviderPlugin.cpp #1120291:1120292
@@ -105,16 +105,14 @@
     if (m_thread) {
         m_thread->exit();
         
-        if (!m_thread->wait( 5000 ) )
-        {
-          mDebug() << "Failed to stop GpsdThread, terminating it.";
-          m_thread->terminate();
+        if ( !m_thread->wait( 5000 ) ) {
+            mDebug() << "Failed to stop GpsdThread";
         }
-
-        m_thread->wait();
+        else {
         delete m_thread;
     }
 }
+}
 
 Q_EXPORT_PLUGIN2( GpsdPositionProviderPlugin, Marble::GpsdPositionProviderPlugin )
 


More information about the Marble-commits mailing list