[gpgme] threadsafe?

Marcus Brinkmann marcus.brinkmann at ruhr-uni-bochum.de
Fri Feb 16 22:51:01 CET 2007

At Tue, 13 Feb 2007 13:32:09 +0100,
Stephan Menzel <smenzel at gmx-gmbh.de> wrote:
> [1  <multipart/signed (7bit)>]
> [1.1  <text/plain; us-ascii (quoted-printable)>]
> Hi Guys,
> I'd just like to know if libgpgme when used to check S/MIME Signatures is 
> threadsafe from within an application when several threads may check using 
> the same engine and database and whatever but each thread got it's own
> gpgme_ctx_t _ctx;
> gpgme_new(&_ctx));
> and
> gpgme_release(_ctx);
> after use.
> That should mean, that each of those contexts is only used once and released 
> afterwards.
> There are no data structures I could see that are shared among the threads. 
> Could the still be a problem when several threads use the lib simultaneously 
> or does the context capsule it sufficiently?

The idea is that GPGME is thread safe in the sense that it should be
safe to use different GPGME objects in different threads at the same
time.  If you want to access the same GPGME objects in different
threads, you are responsible for the necessary synchronization.  This
extends to GPGME contexts as well as GPGME data objects and other
objects (keys, etc).

If you have suggestions how to make this more clear in the manual,
please let me know.

That's the concept.  There may be bugs, as this is not well tested.
Heading over to your other mails on the subject...


More information about the Gnupg-devel mailing list