summaryrefslogtreecommitdiff
path: root/src/ath.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2013-10-02 16:56:46 +0200
committerWerner Koch <wk@gnupg.org>2013-10-02 17:37:26 +0200
commit2f767f6a17f7e99da4075882f7fe3ca597b31bdb (patch)
tree7c1bbc69d914486948313267d6cf790f18aadf26 /src/ath.c
parent6410152338a2b2ac1216e70c153cd16f9199c94e (diff)
downloadlibgcrypt-2f767f6a17f7e99da4075882f7fe3ca597b31bdb.tar.gz
Provide Pth compatiblity for use with GnuPG 2.0.
* src/ath.c (ath_install): Call ath_init and declare Pth as compatible. -- GnuPG 2.0 requires GNU Pth which is a plain userland thread implementation. Given that decent versions of GNU Pth seem to work together with pthread, we can declare Pth as compatible. Native pthreads in Libgcrypt are only used internal to Libgcrypt and any internal blocking should be invisible to Pth. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'src/ath.c')
-rw-r--r--src/ath.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/ath.c b/src/ath.c
index 1363d9e4..7a7035d4 100644
--- a/src/ath.c
+++ b/src/ath.c
@@ -134,8 +134,14 @@ ath_get_model (int *r_model)
gpg_err_code_t
ath_install (struct ath_ops *ath_ops)
{
+ gpg_err_code_t rc;
unsigned int thread_option;
+ /* Fist call ath_init so that we know our thread model. */
+ rc = ath_init ();
+ if (rc)
+ return rc;
+
/* Check if the requested thread option is compatible to the
thread option we are already committed to. */
thread_option = ath_ops? GET_OPTION (ath_ops->option) : 0;
@@ -149,8 +155,15 @@ ath_install (struct ath_ops *ath_ops)
{
if (thread_option == ATH_THREAD_OPTION_PTHREAD)
return 0; /* Okay - compatible. */
+ if (thread_option == ATH_THREAD_OPTION_PTH)
+ return 0; /* Okay - compatible. */
}
#endif /*USE_POSIX_THREADS_WEAK*/
+ else if (thread_option == ATH_THREAD_OPTION_PTH)
+ {
+ if (thread_model == ath_model_none)
+ return 0; /* Okay - compatible. */
+ }
else if (thread_option == ATH_THREAD_OPTION_DEFAULT)
return 0; /* No thread support requested. */