Diffusion GPGME 5cfdf878fbc6

core: Link all context objects and add _gpgme_get_ctx.

Authored by werner on Jun 12 2019, 10:49 AM.

Description

core: Link all context objects and add _gpgme_get_ctx.

* src/context.h (struct gpgme_context): Add field 'next_ctx'.
* src/gpgme.c (def_lc_lock): Replace by ...
(context_list_lock): new.
(context_list): New variable.
(gpgme_new): Add new context object to the list.
(gpgme_release): Remove context object from the list.
(_gpgme_get_ctx): New function.

To allow mapping a context serial number back to a context object and
to check whether a serialno has still a context object, we need to
link them all together. We already take a lock to setup the locale
and thus the only overhead is in freeing the context.

  • Signed-off-by: Werner Koch <wk@gnupg.org>

Details

Committed
wernerJun 12 2019, 10:50 AM
Parents
rM92883efe7176: core: Introduce a context serial number.
Branches
Unknown
Tags
Unknown