pkgsrc-wip/nzbget/patches/patch-af

41 lines
972 B
Text

$NetBSD: patch-af,v 1.1 2005/12/21 10:28:27 martijnb Exp $
--- Frontend.cpp.orig 2005-09-02 09:00:41.000000000 +0200
+++ Frontend.cpp
@@ -163,6 +163,7 @@ void Frontend::FrontendQueueListEntry( c
DownloadSpeedMonitor::DownloadSpeedMonitor()
{
+ pthread_mutex_init( &m_Mutex, NULL );
ClearStats();
}
@@ -177,7 +178,11 @@ void DownloadSpeedMonitor::Run()
void DownloadSpeedMonitor::UpdateDownloadSpeed()
{
+
float fCurrentDownloadSpeed = g_pNZBQueueCoordinator->CalcCurrentDownloadSpeed();
+
+
+ pthread_mutex_lock(&m_Mutex);
// Only push
if( fCurrentDownloadSpeed <= 0.0f ) return;
@@ -199,12 +204,16 @@ void DownloadSpeedMonitor::UpdateDownloa
m_Seconds10.clear();
m_Minutes.push_back( fAverage );
+
+ pthread_mutex_unlock(&m_Mutex);
}
void DownloadSpeedMonitor::ClearStats()
{
+ pthread_mutex_lock(&m_Mutex);
m_Seconds10.clear();
m_Minutes.clear();
m_Minutes10.clear();
m_Hours.clear();
+ pthread_mutex_unlock(&m_Mutex);
}