[Marble-commits] KDE/kdeedu/marble/src/plugins/render/weather

Bastian Holst bastianholst at gmx.de
Wed Apr 21 19:55:10 CEST 2010


SVN commit 1117266 by bholst:

Adding mutex in Marbles BBCParser for use with the schedule QStack.


 M  +5 -0      BBCParser.cpp  
 M  +1 -0      BBCParser.h  


--- trunk/KDE/kdeedu/marble/src/plugins/render/weather/BBCParser.cpp #1117265:1117266
@@ -64,19 +64,24 @@
     entry.item = item;
     entry.type = type;
 
+    m_scheduleMutex.lock();
     m_schedule.push( entry );
+    m_scheduleMutex.unlock();
 
     ensureRunning();
 }
 
 bool BBCParser::workAvailable()
 {
+    QMutexLocker locker( &m_scheduleMutex );
     return !m_schedule.isEmpty();
 }
 
 void BBCParser::work()
 {
+    m_scheduleMutex.lock();
     ScheduleEntry entry = m_schedule.pop();
+    m_scheduleMutex.unlock();
 
     QFile file( entry.path );
     if( !file.open( QIODevice::ReadOnly | QIODevice::Text ) ) {
--- trunk/KDE/kdeedu/marble/src/plugins/render/weather/BBCParser.h #1117265:1117266
@@ -69,6 +69,7 @@
 
     QList<WeatherData> m_list;
     QStack<ScheduleEntry> m_schedule;
+    QMutex m_scheduleMutex;
     
     static QHash<QString, WeatherData::WeatherCondition> dayConditions;
     static QHash<QString, WeatherData::WeatherCondition> nightConditions;


More information about the Marble-commits mailing list