Multi-threaded mail checking in CVS
- From: David Pickens <dpickens iaesthetic com>
- To: balsa-list gnome org
- Subject: Multi-threaded mail checking in CVS
- Date: Mon, 29 Nov 1999 02:26:33 -0500 (EST)
OK,
I committed my changes to the CVS code tonight. This version corrects many
(but not all) of the potential conflicts, and the messaging between
threads is handled much better than it was in the alpha version.
I've added a 'progress dialog' that lists the source and message number of
the message currently being downloaded. (It leaves a bit to be desired
aesthetically, but this can be adjusted.)
I know that we've been going 'back and forth' about 'threads', and this
first version does require pthreads, but if we decide to add the ability
to compile without threads I'll go back and add this. It seemed easiest
to do this one step at a time. Incidentally, some of the gnu/libc/pthread
pages around indicate that the versions of libc5 included in many
distributions DO support pthreads, but that it's not quite as stable as
glibc. There's no guarantee that it will work for you if you haven't
upgraded to glibc, but it sounds as if it MIGHT and I'd appreciate it if
you'd let me know if it does/doesn't work for you.
At this point, the code 'spams' stderr with information. I'd like to
leave this in until I've heard that it works for other people. If it
crashes/segfaults on you, please send the stderr output from the console.
(Stderr should record every attempt to lock/unlock a mailbox, every
message received by the main thread from the mail retrieval thread,
etc.)
I can give a longer description, but, essentially, this patch creates a
thread whenever a request is made to check new mail. The child thread
checks to see if mail is already being retrieved. If so, it silently
quits and allows the older mail checking process to complete. The mail
checking thread send a 'message' to the parent thread when it finished
checking each 'source' -- each POP3 account, IMAP, Local mail, etc. --
when each POP3 message is retrieved, and when the config. file needs to be
updated to contain the ID of the last message retrieved. It creates a
message structure, and passes the pointer to the this structure through a
pipe. (This structure contains a message 'type', a message 'string', and
in some cases a mailbox pointer.) The pipe activates a callback that
iterates through each pointer, dealing with the messages and freeing them
in order.
In any case, I can't imagine this will work for everyone with any
problems, so please test it and let me know what you think.
My next project may be to extend this to mail sending.
David
PS - I could really use some help in a couple of areas. 1) I just stuffed
the pthread linking info into the Makefile stuff in src. Anyone familiar
with automake stuff could help to make this a bit more 'regular'. 2) I
still need to implement some way preventing people from changing the
folder structure and the basic configuration information while mail is
being checked. If you're interested in doing this I can give you the
basic code required to check to see if the mail checking thread is active,
and how to prevent it from running while changes are made.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]