PATCH: fix damn thread issue



hello,

i think i finally nailed that 'hung' on check issue which cuased the
thread to leave.

well i was really unhappy because this happened and i bugged a lot on
this mailinglist, today i found some time and messed around with gdb
and step'ped through the whole code. here the stuff..

as you know i was able accessing the mailboxes on my localmachine and
i was able sending emails when i have compiled threads, but i was not
able pop3'ing my emails because it locked up or just exited.

well after i step'ped through the code i realized that i needed to
search in src/main-window.c i found the code (which i had previously
in mind for a longer time now) and through the steps i found out that

    pthread_create(&get_mail_thread,
                   NULL, (void *) &check_messages_thread, (void *)0);

    /* Detach so we don't need to pthread_join
     * This means that all resources will be
     * reclaimed as soon as the thread exits
     */
    pthread_detach(get_mail_thread);

the code exits between these two calls, a new thread is initialized
and then detached. then i wanted to run balsa through gdb again and
got something like lib/libpthreads.so.0 cant allocate memory exiting.
so i was totally confused and didnt know what to do now. then i thought
hey libbalsa/threads.h is the equivalent to src/threads.h the one
in libbalsa seem to be for the send part and the other for the pop3
part. now i looked in the 2 headers and didnt found any usefull stuff
until i saw that libbalsa/threads.h has a stdlib.h include and the
other src/threads.h not. now i searched for the MALLOC macro inside
and then it made sense why it didnt work and why i got these memory,
lock, freeze issues its probably because memory cant be allocated
correctly. now i applied the include in src/threads.h too and recompiled
balsa... resettet my system several times and everytime i was able
pop3'ing my messages with threads. i think this is the solution for
all the hassle and trouble. so please review and apply the patch
to the CVS.

-- 
Name....: Ali Akcaagac
Status..: Student Of Computer & Economic Science
E-Mail..: mailto:ali.akcaagac@stud.fh-wilhelmshaven.de
WWW.....: http://www.fh-wilhelmshaven.de/~akcaagaa
--- balsa/src/threads.h.orig	Fri Oct  5 19:55:16 2001
+++ balsa/src/threads.h	Fri Oct  5 19:55:16 2001
@@ -22,6 +22,8 @@
 #ifndef __THREADS_H__
 #define __THREADS_H__
 
+#include <stdlib.h>		/* for malloc() */
+
 /*  define thread globals */
 extern pthread_t get_mail_thread;
 extern pthread_t mblist_thread;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]