mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
- infoviewer_bb.cpp,h: fix determination of hdd-usage in thread
This commit is contained in:
committed by
svenhoefer
parent
94a49e3a51
commit
24ffee6bb2
@@ -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)
|
||||
hddscale->paintProgressBar(bbIconMinX, BBarY + InfoHeightY_Info / 2 + 2 + 0, hddwidth, 6, percent, 100);
|
||||
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)
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user