[Help-gnutls] Thread cancellation

Nikos Mavroyanopoulos nmav at gnutls.org
Fri Dec 19 09:10:05 CET 2003


On Thu, Dec 18, 2003 at 09:32:46AM -0600, Scott Lamb wrote:
> Hello,
> 
> I stumbled onto gnutls through the dmoz/google directory link. I'm quite 
> impressed so far, particularly with the quality of documentation.
> I've got a couple questions I didn't see answered, though:
> - Is gnutls cancellation-safe?
No gnutls is not cancellation safe. I guess that there could be
some memory leaks when cancelation is used. That could be changed
though since the system calls used in gnutls are few, but I don't
know if it is a good idea to make gnutls use libpthread.

According to Werner Libgcrypt is also not cancelation safe, but
this may change within the 1.2.x releases of libgcrypt (libgcrypt
already depends on pthread due to some locking required).

> - Similarly, is it exception-safe?
No. gnutls is written in plain C, with no exceptions in mind.

> Exception safety is pretty similar. I'd be thrilled if I could define a 
> new transport layer and throw C++ exceptions all the way through the 
> gnutls code to my code on the other side. If the transport operations 
> are considered cancellation points (without using pthread_cleanup_xxx), 
> it's exception-safe. (Provided that I compile with -fexceptions, but 
> that's easy.) It'd save me the trouble of converting my exceptions to 
> C-friendly errors and back again.
Currently that would be the case. The callbacks should report errors
using the C interface defined.

> Thanks,
> Scott Lamb

-- 
Nikos Mavroyanopoulos





More information about the Gnutls-help mailing list