mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-18 11:05:18 +00:00
infopipe work in progress
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@463 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
parent
f61b0c7a61
commit
09a10701df
@ -35,6 +35,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "conky.h"
|
#include "conky.h"
|
||||||
|
|
||||||
|
/* access to this item array is synchronized with mutexes */
|
||||||
static char g_item[14][256];
|
static char g_item[14][256];
|
||||||
|
|
||||||
/* ----------------------------------------
|
/* ----------------------------------------
|
||||||
@ -99,15 +100,14 @@ void *infopipe_service(void *pvoid)
|
|||||||
if (read(fd,buf,sizeof(buf))>0) {
|
if (read(fd,buf,sizeof(buf))>0) {
|
||||||
|
|
||||||
pbuf=buf;
|
pbuf=buf;
|
||||||
|
pthread_mutex_lock(&info.infopipe.item_mutex);
|
||||||
for (i=0;i<14;i++) {
|
for (i=0;i<14;i++) {
|
||||||
sscanf(pbuf,"%*[^:]: %[^\n]",g_item[i]);
|
sscanf(pbuf,"%*[^:]: %[^\n]",g_item[i]);
|
||||||
while(*pbuf++ != '\n');
|
while(*pbuf++ != '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
pthread_mutex_lock(&info.infopipe.item_mutex);
|
|
||||||
memcpy(&info.infopipe.item,g_item,sizeof(g_item));
|
|
||||||
pthread_mutex_unlock(&info.infopipe.item_mutex);
|
pthread_mutex_unlock(&info.infopipe.item_mutex);
|
||||||
/*
|
|
||||||
|
/* -- debug to console --
|
||||||
for(i=0;i<14;i++)
|
for(i=0;i<14;i++)
|
||||||
printf("%s\n",g_item[i]);
|
printf("%s\n",g_item[i]);
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user