- infoviewer_bb.cpp,h: fix determination of hdd-usage in thread

This commit is contained in:
svenhoefer, snafed
2012-11-06 22:05:45 +01:00
committed by svenhoefer
parent 94a49e3a51
commit 24ffee6bb2
2 changed files with 17 additions and 13 deletions

View File

@@ -87,6 +87,7 @@ CInfoViewerBB::CInfoViewerBB()
pthread_detach(scrambledT);
}
#endif
hddpercent = 0;
hddperT = 0;
hddperTflag = false;
bbIconInfo[0].x = 0;
@@ -612,20 +613,17 @@ void CInfoViewerBB::showSysfsHdd()
percent = (u * 100ULL) / t;
showBarSys(percent);
#if 0
//HDD info in a seperate thread
if(!hddperTflag) {
hddperTflag=true;
pthread_create(&hddperT, NULL, hddperThread, (void*) this);
pthread_detach(hddperT);
}
#else
if (!check_dir(g_settings.network_nfs_recordingdir)) {
if (get_fs_usage(g_settings.network_nfs_recordingdir, t, u))
percent = (u * 100ULL) / t;
showBarHdd(percent);
}
#endif
if (check_dir(g_settings.network_nfs_recordingdir) == 0)
showBarHdd(hddpercent);
else
showBarHdd(-1);
}
}
@@ -633,11 +631,10 @@ void* CInfoViewerBB::hddperThread(void *arg)
{
CInfoViewerBB *infoViewerBB = (CInfoViewerBB*) arg;
int percent = 0;
infoViewerBB->hddpercent = 0;
long t, u;
if (get_fs_usage(g_settings.network_nfs_recordingdir, t, u))
percent = (u * 100ULL) / t;
infoViewerBB->showBarHdd(percent);
infoViewerBB->hddpercent = (u * 100ULL) / t;
infoViewerBB->hddperTflag=false;
pthread_exit(NULL);
@@ -651,8 +648,14 @@ void CInfoViewerBB::showBarSys(int percent)
void CInfoViewerBB::showBarHdd(int percent)
{
if (is_visible)
if (is_visible) {
if (percent >= 0)
hddscale->paintProgressBar(bbIconMinX, BBarY + InfoHeightY_Info / 2 + 2 + 0, hddwidth, 6, percent, 100);
else {
frameBuffer->paintBoxRel(bbIconMinX, BBarY + InfoHeightY_Info / 2 + 2 + 0, hddwidth, 6, COL_INFOBAR_BUTTONS_BACKGROUND);
hddscale->reset();
}
}
}
void CInfoViewerBB::paint_ca_icons(int caid, char * icon, int &icon_space_offset)

View File

@@ -124,6 +124,7 @@ class CInfoViewerBB
void showBarSys(int percent = 0);
void showBarHdd(int percent = 0);
int hddpercent;
pthread_t hddperT;
static void* hddperThread(void *arg);
bool hddperTflag;