1
0
Fork 0

More fixes to get the code working when threads are disabled.

This commit is contained in:
ehofman 2004-09-10 07:54:45 +00:00
parent 8437524d6b
commit f42e3cb2ac
2 changed files with 5 additions and 5 deletions

View file

@ -323,11 +323,9 @@ FGMetarEnvironmentCtrl::FGMetarEnvironmentCtrl ()
fetch_elapsed( 9999.0 ), fetch_elapsed( 9999.0 ),
proxy_host( fgGetNode("/sim/presets/proxy/host", true) ), proxy_host( fgGetNode("/sim/presets/proxy/host", true) ),
proxy_port( fgGetNode("/sim/presets/proxy/port", true) ), proxy_port( fgGetNode("/sim/presets/proxy/port", true) ),
proxy_auth( fgGetNode("/sim/presets/proxy/authentication", true) ) proxy_auth( fgGetNode("/sim/presets/proxy/authentication", true) ),
#if defined(ENABLE_THREADS) && ENABLE_THREADS _error_dt( 0.0 ),
,_error_dt( 0.0 ),
_error_count( 0 ) _error_count( 0 )
#endif
{ {
#if defined(ENABLE_THREADS) && ENABLE_THREADS #if defined(ENABLE_THREADS) && ENABLE_THREADS
thread = new MetarThread(this); thread = new MetarThread(this);
@ -548,11 +546,13 @@ FGMetarEnvironmentCtrl::fetch_data( const string &icao )
} catch (const sg_io_exception& e) { } catch (const sg_io_exception& e) {
SG_LOG( SG_GENERAL, SG_WARN, "Error fetching live weather data: " SG_LOG( SG_GENERAL, SG_WARN, "Error fetching live weather data: "
<< e.getFormattedMessage().c_str() ); << e.getFormattedMessage().c_str() );
#if defined(ENABLE_THREADS) && ENABLE_THREADS
if (_error_count++ >= 3) { if (_error_count++ >= 3) {
SG_LOG( SG_GENERAL, SG_WARN, "Stop fetching data permanently."); SG_LOG( SG_GENERAL, SG_WARN, "Stop fetching data permanently.");
thread->cancel(); thread->cancel();
thread->join(); thread->join();
} }
#endif
result.m = NULL; result.m = NULL;
} }

View file

@ -249,11 +249,11 @@ private:
*/ */
friend void metar_cleanup_handler( void* ); friend void metar_cleanup_handler( void* );
#endif // ENABLE_THREADS
int _error_count; int _error_count;
double _dt; double _dt;
double _error_dt; double _error_dt;
#endif // ENABLE_THREADS
}; };
#endif // _ENVIRONMENT_CTRL_HXX #endif // _ENVIRONMENT_CTRL_HXX