1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-25 04:06:03 +00:00

getting set for 1.4.0

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@525 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Brenden Matthews 2006-02-13 02:28:46 +00:00
parent 9d54a08e65
commit a99f1c48e7
7 changed files with 30 additions and 59 deletions

2
README
View File

@ -1027,4 +1027,4 @@ AUTHORS
2006-01-01 conky(1) 2006-02-12 conky(1)

View File

@ -3,6 +3,6 @@
aclocal-1.9 aclocal-1.9
libtoolize --force libtoolize --force
autoheader autoheader-2.59
automake-1.9 -a automake-1.9 -a
autoconf autoconf-2.59

View File

@ -1,6 +1,6 @@
AC_INIT([Conky],[1.4.0_CVS_20060126],[brenden1@users.sourceforge.net]) AC_INIT([Conky],[1.4.0],[brenden1@users.sourceforge.net])
AM_INIT_AUTOMAKE(conky, 1.4.0_CVS_20060126) AM_INIT_AUTOMAKE(conky, 1.4.0)
AM_CONFIG_HEADER(src/config.h) AM_CONFIG_HEADER(src/config.h)
AC_PROG_LIBTOOL AC_PROG_LIBTOOL
PKG_PROG_PKG_CONFIG([0.17.2]) PKG_PROG_PKG_CONFIG([0.17.2])

View File

@ -1,5 +1,5 @@
.\" -*- coding: us-ascii -*- .\" -*- coding: us-ascii -*-
.TH conky 1 2006-01-01 .TH conky 1 2006-02-12
.SH NAME .SH NAME
conky \- A system monitor for X originally based on the torsmo code, but more kickass. It just keeps on given'er. Yeah. conky \- A system monitor for X originally based on the torsmo code, but more kickass. It just keeps on given'er. Yeah.
.SH SYNOPSIS .SH SYNOPSIS

View File

@ -16,7 +16,7 @@
<firstname>Brenden</firstname> <firstname>Brenden</firstname>
<surname>Matthews</surname> <surname>Matthews</surname>
</author> </author>
<date>2006-01-01</date> <date>2006-02-12</date>
</refentryinfo> </refentryinfo>
<refmeta> <refmeta>

View File

@ -407,7 +407,7 @@ static int special_index; /* used when drawing */
static struct special_t *new_special(char *buf, int t) static struct special_t *new_special(char *buf, int t)
{ {
if (special_count >= 256) if (special_count >= 512)
CRIT_ERR("too many special things in text"); CRIT_ERR("too many special things in text");
buf[0] = SPECIAL_CHAR; buf[0] = SPECIAL_CHAR;
@ -921,7 +921,6 @@ enum text_object_type {
}; };
struct thread_info_s { struct thread_info_s {
pthread_mutex_t mutex;
pthread_t thread; pthread_t thread;
}; };
@ -1009,6 +1008,7 @@ static void generate_text_internal(char *p, int p_max_size, struct text_object *
typedef struct thread_info_s *thread_info; typedef struct thread_info_s *thread_info;
static thread_info thread_list[MAX_THREADS]; static thread_info thread_list[MAX_THREADS];
static int thread_count = 0; static int thread_count = 0;
static int threads_runnable = 1;
int register_thread(struct thread_info_s *new_thread) int register_thread(struct thread_info_s *new_thread)
{ {
@ -1021,24 +1021,6 @@ int register_thread(struct thread_info_s *new_thread)
return thread_count - 1; return thread_count - 1;
} }
void lock_all_threads()
{
if (thread_count) {
ERR("trying to end all threads");
int i, ret;
// now we wait to get the locks
for (i = 0; i < thread_count; i++) {
usleep(50);
ret = pthread_mutex_lock(&(thread_list[i]->mutex));
if (ret) {
ERR("giving up on thread %i", (int)thread_list[i]->thread);
} else {
ERR("locked %i of %i", i+1, thread_count);
}
}
}
}
void replace_thread(struct thread_info_s *new_thread, int pos) // this isn't even used anymore; oh wells void replace_thread(struct thread_info_s *new_thread, int pos) // this isn't even used anymore; oh wells
{ {
if (pos >= 0 && pos < MAX_THREADS) { if (pos >= 0 && pos < MAX_THREADS) {
@ -1050,39 +1032,25 @@ void replace_thread(struct thread_info_s *new_thread, int pos) // this isn't eve
void *threaded_exec(struct text_object *obj) { // pthreads are really beginning to piss me off void *threaded_exec(struct text_object *obj) { // pthreads are really beginning to piss me off
double update_time; double update_time;
int unlock; int run_code = threads_runnable;
while (1) { while (threads_runnable == run_code) {
update_time = get_time(); update_time = get_time();
if (pthread_mutex_trylock(&(obj->data.execi.thread_info.mutex))) {
pthread_exit(NULL);
}
char *p2 = obj->data.execi.buffer; char *p2 = obj->data.execi.buffer;
FILE *fp = popen(obj->data.execi.cmd,"r"); FILE *fp = popen(obj->data.execi.cmd,"r");
int n2 = fread(p2, 1, TEXT_BUFFER_SIZE, fp); int n2 = fread(p2, 1, TEXT_BUFFER_SIZE, fp);
(void) pclose(fp); (void) pclose(fp);
p2[n2] = '\0'; p2[n2] = '\0';
if (n2 && p2[n2 - 1] == '\n') if (n2 && p2[n2 - 1] == '\n') {
p2[n2 - 1] = '\0'; p2[n2 - 1] = '\0';
}
while (*p2) { while (*p2) {
if (*p2 == '\001') if (*p2 == '\001') {
*p2 = ' '; *p2 = ' ';
}
p2++; p2++;
} }
obj->data.execi.last_update = update_time; obj->data.execi.last_update = update_time;
unlock = pthread_mutex_unlock(&(obj->data.execi.thread_info.mutex));
if (unlock) {
ERR("error %i unlocking thread", unlock);
pthread_exit(NULL);
}
usleep(100); // prevent race condition usleep(100); // prevent race condition
if (pthread_mutex_trylock(&(obj->data.execi.thread_info.mutex))) {
pthread_exit(NULL);
}
unlock = pthread_mutex_unlock(&(obj->data.execi.thread_info.mutex));
if (unlock) {
ERR("error %i unlocking thread", unlock);
pthread_exit(NULL);
}
if (get_time() - obj->data.execi.last_update > obj->data.execi.interval) { if (get_time() - obj->data.execi.last_update > obj->data.execi.interval) {
continue; continue;
} else { } else {
@ -1093,7 +1061,9 @@ void *threaded_exec(struct text_object *obj) { // pthreads are really beginning
usleep(delay); usleep(delay);
} }
} }
ERR("exiting thread");
pthread_exit(NULL); pthread_exit(NULL);
return 0;
} }
static struct text_object *new_text_object_internal() static struct text_object *new_text_object_internal()
@ -2237,7 +2207,6 @@ void parse_conky_vars(char * text, char * p, struct information *cur) {
static void generate_text_internal(char *p, int p_max_size, struct text_object *objs, unsigned int object_count, struct information *cur) static void generate_text_internal(char *p, int p_max_size, struct text_object *objs, unsigned int object_count, struct information *cur)
{ {
unsigned int i; unsigned int i;
for (i = 0; i < object_count; i++) { for (i = 0; i < object_count; i++) {
struct text_object *obj = &objs[i]; struct text_object *obj = &objs[i];
@ -2660,14 +2629,10 @@ static void generate_text_internal(char *p, int p_max_size, struct text_object *
OBJ(texeci) { OBJ(texeci) {
if (obj->data.execi.pos < 0) { if (obj->data.execi.pos < 0) {
obj->data.execi.last_update = current_update_time; obj->data.execi.last_update = current_update_time;
pthread_mutex_init(&(obj->data.execi.thread_info.mutex), NULL);
if (!obj->data.execi.thread_info.thread && !pthread_mutex_trylock(&(obj->data.execi.thread_info.mutex))) {
if (pthread_create(&(obj->data.execi.thread_info.thread), NULL, (void*)threaded_exec, (void*) obj)) { if (pthread_create(&(obj->data.execi.thread_info.thread), NULL, (void*)threaded_exec, (void*) obj)) {
ERR("Error starting thread"); ERR("Error starting thread");
} }
obj->data.execi.pos = register_thread(&(obj->data.execi.thread_info)); obj->data.execi.pos = register_thread(&(obj->data.execi.thread_info));
pthread_mutex_unlock(&(obj->data.execi.thread_info.mutex));
}
} }
snprintf(p, p_max_size, "%s", obj->data.execi.buffer); snprintf(p, p_max_size, "%s", obj->data.execi.buffer);
} }
@ -4674,7 +4639,8 @@ static void load_config_file(const char *);
/* reload the config file */ /* reload the config file */
void reload_config(void) void reload_config(void)
{ {
lock_all_threads(); //lock_all_threads();
threads_runnable++;
#if defined(XMMS) || defined(BMP) || defined(AUDACIOUS) || defined(INFOPIPE) #if defined(XMMS) || defined(BMP) || defined(AUDACIOUS) || defined(INFOPIPE)
if (info.xmms.thread) { if (info.xmms.thread) {
if (destroy_xmms_thread()!=0) if (destroy_xmms_thread()!=0)
@ -4716,7 +4682,8 @@ void reload_config(void)
void clean_up(void) void clean_up(void)
{ {
lock_all_threads(); //lock_all_threads();
threads_runnable++;
#ifdef X11 #ifdef X11
#ifdef XDBE #ifdef XDBE
if (use_xdbe) { if (use_xdbe) {
@ -5256,7 +5223,11 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, b) == 0)
set_transparent = string_to_bool(value); set_transparent = string_to_bool(value);
} }
CONF("own_window_colour") { CONF("own_window_colour") {
if (value) {
background_colour = get_x11_color(value); background_colour = get_x11_color(value);
} else {
ERR("Invalid colour for own_winder_colour (try omitting the '#' for hex colours");
}
} }
#endif #endif
CONF("stippled_borders") { CONF("stippled_borders") {

View File

@ -49,7 +49,7 @@
#define TOP_PID 3 #define TOP_PID 3
#define TOP_MEM 4 #define TOP_MEM 4
#define TEXT_BUFFER_SIZE 1024 #define TEXT_BUFFER_SIZE 1280
#define P_MAX_SIZE ((TEXT_BUFFER_SIZE * 4) - 2) #define P_MAX_SIZE ((TEXT_BUFFER_SIZE * 4) - 2)
#include <sys/socket.h> #include <sys/socket.h>