1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-18 02:55:12 +00:00

fix thread definitions

* we code against interfaces (void *f(void *))
* casting function pointers to object pointers
  is a no-no says gcc


git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1065 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Phil 2008-03-29 05:14:35 +00:00
parent fea715f038
commit 963bb6211c
4 changed files with 22 additions and 15 deletions

View File

@ -289,7 +289,7 @@ void update_stuff(void)
if (NEED(INFO_MPD)) {
if (!mpd_timed_thread) {
init_mpd_stats(&info);
mpd_timed_thread = timed_thread_create((void *) update_mpd,
mpd_timed_thread = timed_thread_create(&update_mpd,
(void *) NULL, info.music_player_interval * 1000000);
if (!mpd_timed_thread) {
ERR("Failed to create MPD timed thread");

View File

@ -1537,7 +1537,7 @@ struct mail_s *parse_mail_args(char type, const char *arg)
return mail;
}
void *imap_thread(struct mail_s *mail)
void *imap_thread(void *arg)
{
int sockfd, numbytes;
char recvbuf[MAXDATASIZE];
@ -1549,6 +1549,7 @@ void *imap_thread(struct mail_s *mail)
struct stat stat_buf;
struct hostent *he;
struct sockaddr_in their_addr; // connector's address information
struct mail_s *mail = (struct mail_s *)arg;
if ((he = gethostbyname(mail->host)) == NULL) { // get the host info
herror("gethostbyname");
@ -1722,7 +1723,7 @@ next_iteration:
return 0;
}
void *pop3_thread(struct mail_s *mail)
void *pop3_thread(void *arg)
{
int sockfd, numbytes;
char recvbuf[MAXDATASIZE];
@ -1733,6 +1734,7 @@ void *pop3_thread(struct mail_s *mail)
struct stat stat_buf;
struct hostent *he;
struct sockaddr_in their_addr; // connector's address information
struct mail_s *mail = (struct mail_s *)arg;
if ((he = gethostbyname(mail->host)) == NULL) { // get the host info
herror("gethostbyname");
@ -1922,9 +1924,10 @@ next_iteration:
return 0;
}
void *threaded_exec(struct text_object *obj)
void *threaded_exec(void *arg)
{
while (1) {
struct text_object *obj = (struct text_object *)arg;
char *p2 = obj->data.texeci.buffer;
FILE *fp = popen(obj->data.texeci.cmd, "r");
@ -4853,7 +4856,7 @@ static void generate_text_internal(char *p, int p_max_size,
OBJ(texeci) {
if (!obj->data.texeci.p_timed_thread) {
obj->data.texeci.p_timed_thread =
timed_thread_create((void *) threaded_exec,
timed_thread_create(&threaded_exec,
(void *) obj, obj->data.texeci.interval * 1000000);
if (!obj->data.texeci.p_timed_thread) {
ERR("Error creating texeci timed thread");
@ -4874,7 +4877,7 @@ static void generate_text_internal(char *p, int p_max_size,
// this means we use info
if (!info.mail->p_timed_thread) {
info.mail->p_timed_thread =
timed_thread_create((void *) imap_thread,
timed_thread_create(&imap_thread,
(void *) info.mail, info.mail->interval * 1000000);
if (!info.mail->p_timed_thread) {
ERR("Error creating imap timed thread");
@ -4892,7 +4895,7 @@ static void generate_text_internal(char *p, int p_max_size,
// this means we use obj
if (!obj->data.mail->p_timed_thread) {
obj->data.mail->p_timed_thread =
timed_thread_create((void *) imap_thread,
timed_thread_create(&imap_thread,
(void *) obj->data.mail,
obj->data.mail->interval * 1000000);
if (!obj->data.mail->p_timed_thread) {
@ -4920,7 +4923,7 @@ static void generate_text_internal(char *p, int p_max_size,
// this means we use info
if (!info.mail->p_timed_thread) {
info.mail->p_timed_thread =
timed_thread_create((void *) imap_thread,
timed_thread_create(&imap_thread,
(void *) info.mail, info.mail->interval * 1000000);
if (!info.mail->p_timed_thread) {
ERR("Error creating imap timed thread");
@ -4938,7 +4941,7 @@ static void generate_text_internal(char *p, int p_max_size,
// this means we use obj
if (!obj->data.mail->p_timed_thread) {
obj->data.mail->p_timed_thread =
timed_thread_create((void *) imap_thread,
timed_thread_create(&imap_thread,
(void *) obj->data.mail,
obj->data.mail->interval * 1000000);
if (!obj->data.mail->p_timed_thread) {
@ -4966,7 +4969,7 @@ static void generate_text_internal(char *p, int p_max_size,
// this means we use info
if (!info.mail->p_timed_thread) {
info.mail->p_timed_thread =
timed_thread_create((void *) pop3_thread,
timed_thread_create(&pop3_thread,
(void *) info.mail, info.mail->interval * 1000000);
if (!info.mail->p_timed_thread) {
ERR("Error creating pop3 timed thread");
@ -4984,7 +4987,7 @@ static void generate_text_internal(char *p, int p_max_size,
// this means we use obj
if (!obj->data.mail->p_timed_thread) {
obj->data.mail->p_timed_thread =
timed_thread_create((void *) pop3_thread,
timed_thread_create(&pop3_thread,
(void *) obj->data.mail,
obj->data.mail->interval * 1000000);
if (!obj->data.mail->p_timed_thread) {
@ -5012,7 +5015,7 @@ static void generate_text_internal(char *p, int p_max_size,
// this means we use info
if (!info.mail->p_timed_thread) {
info.mail->p_timed_thread =
timed_thread_create((void *) pop3_thread,
timed_thread_create(&pop3_thread,
(void *) info.mail, info.mail->interval * 1000000);
if (!info.mail->p_timed_thread) {
ERR("Error creating pop3 timed thread");
@ -5031,7 +5034,7 @@ static void generate_text_internal(char *p, int p_max_size,
// this means we use obj
if (!obj->data.mail->p_timed_thread) {
obj->data.mail->p_timed_thread =
timed_thread_create((void *) pop3_thread,
timed_thread_create(&pop3_thread,
(void *) obj->data.mail,
obj->data.mail->interval * 1000000);
if (!obj->data.mail->p_timed_thread) {

View File

@ -687,7 +687,7 @@ char *get_apm_battery_time(void);
/* in mpd.c */
#ifdef MPD
extern void init_mpd_stats(struct information *current_info);
void *update_mpd(void);
void *update_mpd(void *);
extern timed_thread *mpd_timed_thread;
void free_mpd_vars(struct information *current_info);
#endif /* MPD */

View File

@ -127,10 +127,14 @@ void clear_mpd_stats(struct information *current_info)
current_info->mpd.length = 0;
}
void *update_mpd(void)
void *update_mpd(void *arg)
{
struct information *current_info = &info;
if (arg) {
/* make gcc happy (unused argument) */
}
while (1) {
if (!current_info->conn) {
current_info->conn = mpd_newConnection(current_info->mpd.host,