core: Use gpgrt locking for thread safeness
authorAndre Heinecke <aheinecke@intevation.de>
Tue, 8 Nov 2016 14:32:14 +0000 (15:32 +0100)
committerAndre Heinecke <aheinecke@intevation.de>
Thu, 10 Nov 2016 12:33:13 +0000 (13:33 +0100)
commit09b64554328445e99a8cc78fc34ea49c2ea2e7f9
treef5d68498f7b5b099a62486c45ce5aa23ee6445d3
parentf1f341062e24724e26928d893dd5769d3ccf5fa2
core: Use gpgrt locking for thread safeness

* configure.ac: Require libgpg-error 1.17. No longer
check for pthread.
* doc/gpgme.texi: Document removed neccessity for thread
safe gpgme flavours.
* src/sema.h (DEFINE_GLOBAL_LOCK),
(DEFINE_STATIC_LOCK, INIT_LOCK, DECLARE_LOCK)
(DESTROY_LOCK, LOCK, UNLOCK): Change to gpgrt equivalents.
* src/posix-sema.c, src/w32-sema.c: Removed.
* src/Makefile.am: Remove libpthread and
Update accordingly.
* src/ath.c, src/ath.h (ath_mutex_init)
(ath_mutex_destroy, ath_mutex_lock, ath_mutex_unlock): Removed.
* src/ath.h (ATH_MUTEX_INITIALIZER): Removed.
* src/version.c (do_subsystem_inits): sema_subsystem_init is
no longer required.
* tests/gpg/Makefile.am: Add new threading tests.
(t_thread1_LDADD, t_cancel_LDADD):
Use just gpgme.
* tests/gpg/t-thread-keylist-verify.c,
tests/gpg/t-thread-keylist.c: New.
* src/gpgme-config.in: Use -lgpgme for thread-model pthread.

--
Using gpgrt locks instead of pthread locks removes
the neccessity to link pthread directly to gpgme and
have a different, thread safe flavor of gpgme. Now
gpgme is thread-safe if the conditions mentioned
in the doc are met.

As the cpp bindings linked against libgpgme
and not libgpgme-pthread this fixes threading problems
with them.

libgpgme-pthread is removed but gpgme-config still supports
--thread=pthread for compatibility with find scripts.
14 files changed:
configure.ac
doc/gpgme.texi
src/Makefile.am
src/ath-pthread.c [deleted file]
src/ath.c
src/ath.h
src/gpgme-config.in
src/posix-sema.c [deleted file]
src/sema.h
src/version.c
src/w32-sema.c [deleted file]
tests/gpg/Makefile.am
tests/gpg/t-thread-keylist-verify.c [new file with mode: 0644]
tests/gpg/t-thread-keylist.c [new file with mode: 0644]