Re: multithreaded use

DINH Viet Hoa <[email protected]>
Newsgroups gmane.mail.libetpan.user
Message-ID <etPan.423f40c0.d457b71.2363@utopia>
Hello,

Luke Ehresman wrote :

> I'm excited to find libetpan!  I have been using c-client, but
> discovered its limitations in a multi-threaded environment.  I have
> searched and searched for another good C imap library, but for some
> reason never ran across this project until now.  It looks like exactly
> what I need.
> 
> I have read through the documentation and there was one question I
> still have that was left unanswered.  Is this library thread safe?  The
> c-client library is not, and I started working on making it thread
> safe, but it was going to be a massive project.

libetpan is not thread safe but it is reentrant.
That means that you can do calls from several thread if you do
manipulate different datastructure in those threads.

> I am working on a multi-user webmail system (Aeromys --
> www.aeromys.org).  Each user will have a unique connection to his or
> her mail server.  There will only be one connection per user, but there
> will be multiple users in different threads.  Will this library handle
> this situation without problems?

That kind of situation will be handled without problems.

> Along the same lines, would it be possible for me to remove the
> limitation of having only one thread working on a connection at a
> time?  By this I mean, could I have a background thread caching mail
> for the user while he/she is also browsing?  Both of these threads
> would be working on the same connection.

You will have to lock the access to the connection.
Basically, a mail access will be represented by an object 'storage', 
each time you want to access this mail access, you will have to lock 
that object.

> Thanks for your time, I am seriously hoping this library will save me
> from having to write my own.  It looks very promising.  Good work, and
> thanks.

I am using this library in a multithreaded IMAP client : etpan-ng.

-- 
DINH V. Hoa,

"ben le problème c'est que les voitures à motorisations XXL
    ça passe rarement inaperçu" -- raoul
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQBCP0Hx7w+pfAWHa3MRAq58AJ9h/nnaJuv8X7RbrhH2ZjYJ/KVFQwCeJ+Yd
ZfAR09NsH9Tf9is0QPgd20Q=
=d+hT
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.