mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-24 11:55:43 +00:00
stuff
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@524 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
parent
d7635e7c1b
commit
9d54a08e65
20
src/conky.c
20
src/conky.c
@ -1032,6 +1032,8 @@ void lock_all_threads()
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1048,10 +1050,11 @@ 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
|
||||
double update_time;
|
||||
int unlock;
|
||||
while (1) {
|
||||
update_time = get_time();
|
||||
if (pthread_mutex_trylock(&(obj->data.execi.thread_info.mutex))) {
|
||||
break;
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
char *p2 = obj->data.execi.buffer;
|
||||
FILE *fp = popen(obj->data.execi.cmd,"r");
|
||||
@ -1066,15 +1069,24 @@ void *threaded_exec(struct text_object *obj) { // pthreads are really beginning
|
||||
p2++;
|
||||
}
|
||||
obj->data.execi.last_update = update_time;
|
||||
usleep(100); // prevent race condition
|
||||
int unlock = pthread_mutex_unlock(&(obj->data.execi.thread_info.mutex));
|
||||
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
|
||||
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) {
|
||||
continue;
|
||||
} else {
|
||||
unsigned int delay = 1000000 * (obj->data.execi.interval -(get_time() - obj->data.execi.last_update));
|
||||
unsigned int delay = 1000000.0 * (obj->data.execi.interval -(get_time() - obj->data.execi.last_update));
|
||||
if (delay < update_interval * 500000) {
|
||||
delay = update_interval * 1000000;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user