1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-17 18:45:10 +00:00

execi issues resolved?

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@446 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Brenden Matthews 2005-12-15 02:30:41 +00:00
parent ad283f4e91
commit f497f4d500
2 changed files with 12 additions and 8 deletions

View File

@ -1,5 +1,8 @@
# $Id$ # $Id$
2005-12-14
* Fixed issues with execi stuff
2005-12-10 2005-12-10
* Added sf.net patch 1374576 * Added sf.net patch 1374576

View File

@ -2386,7 +2386,7 @@ static void generate_text_internal(char *p, int p_max_size, struct text_object *
} }
OBJ(execibar) { OBJ(execibar) {
if (current_update_time - obj->data.execi.last_update < obj->data.execi.interval || !obj->data.execi.last_update) { if (current_update_time - obj->data.execi.last_update >= obj->data.execi.interval || !obj->data.execi.last_update) {
new_bar(p, 0, 4, (int) obj->f); new_bar(p, 0, 4, (int) obj->f);
} else { } else {
char *p2 = p; char *p2 = p;
@ -2417,7 +2417,7 @@ static void generate_text_internal(char *p, int p_max_size, struct text_object *
} }
} }
OBJ(execigraph) { OBJ(execigraph) {
if (current_update_time - obj->data.execi.last_update < obj->data.execi.interval || !obj->data.execi.last_update) { if (current_update_time - obj->data.execi.last_update >= obj->data.execi.interval || !obj->data.execi.last_update) {
new_graph(p, 0, 25, obj->c, obj->d, (int) (obj->f), 100, 0); new_graph(p, 0, 25, obj->c, obj->d, (int) (obj->f), 100, 0);
} else { } else {
char *p2 = p; char *p2 = p;
@ -2450,7 +2450,7 @@ static void generate_text_internal(char *p, int p_max_size, struct text_object *
} }
OBJ(execi) { OBJ(execi) {
char *output = obj->data.execi.buffer; char *output = obj->data.execi.buffer;
if (current_update_time - obj->data.execi.last_update < obj->data.execi.interval || !obj->data.execi.last_update) { if (current_update_time - obj->data.execi.last_update >= obj->data.execi.interval || !obj->data.execi.last_update) {
char *output = obj->data.execi.buffer; char *output = obj->data.execi.buffer;
FILE *fp = popen(obj->data.execi.cmd, "r"); FILE *fp = popen(obj->data.execi.cmd, "r");
int length = fread(output, 1, TEXT_BUFFER_SIZE, fp); int length = fread(output, 1, TEXT_BUFFER_SIZE, fp);
@ -2466,17 +2466,18 @@ static void generate_text_internal(char *p, int p_max_size, struct text_object *
} }
OBJ(texeci) { OBJ(texeci) {
static int running = 0; static int running = 0;
if (current_update_time - obj->data.execi.last_update < obj->data.execi.interval || !obj->data.execi.last_update) { if (current_update_time - obj->data.execi.last_update >= obj->data.execi.interval) {
static pthread_t execthread; static pthread_t execthread;
if (running) {
pthread_join( execthread, NULL);
running = 0;
}
if (!running) { if (!running) {
running = 1; running = 1;
pthread_create( &execthread, NULL, (void*)threaded_exec, (void*) obj); pthread_create( &execthread, NULL, (void*)threaded_exec, (void*) obj);
pthread_mutex_lock( &mutex1 ); pthread_mutex_lock( &mutex1 );
obj->data.execi.last_update = current_update_time; obj->data.execi.last_update = current_update_time;
pthread_mutex_unlock( &mutex1 ); pthread_mutex_unlock( &mutex1 );
} else {
pthread_join( execthread, NULL);
running = 0;
} }
} }
parse_conky_vars(obj->data.execi.buffer, p, cur); parse_conky_vars(obj->data.execi.buffer, p, cur);