aboutsummaryrefslogtreecommitdiffstats
path: root/agent/call-scd.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2004-12-19 17:44:20 +0000
committerWerner Koch <[email protected]>2004-12-19 17:44:20 +0000
commit8f22f895e94d45755c99470eb76fd9fd508b5b5f (patch)
treec428f9546b0f65eeb0189214b1ebabeededd65ec /agent/call-scd.c
parent* maperror.c (map_assuan_err_with_source): Oops, args were swapped. (diff)
downloadgnupg-8f22f895e94d45755c99470eb76fd9fd508b5b5f.tar.gz
gnupg-8f22f895e94d45755c99470eb76fd9fd508b5b5f.zip
* query.c (initialize_module_query):
* call-scd.c (initialize_module_call_scd): New. * w32-pth.c (pth_init): Enable debugging depending on env var. (pth_self): New. (pth_mutex_release, pth_mutex_acquire): Implemented directly using the W32 API.
Diffstat (limited to '')
-rw-r--r--agent/call-scd.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/agent/call-scd.c b/agent/call-scd.c
index 828040772..90c625f8b 100644
--- a/agent/call-scd.c
+++ b/agent/call-scd.c
@@ -52,7 +52,7 @@
static ASSUAN_CONTEXT scd_ctx = NULL;
#ifdef USE_GNU_PTH
-static pth_mutex_t scd_lock = PTH_MUTEX_INIT;
+static pth_mutex_t scd_lock;
#endif
/* We need to keep track of the connection currently using the SCD.
For a pipe server this is all a NOP because the connection will
@@ -153,6 +153,23 @@ get_membuf (struct membuf *mb, size_t *len)
+/* This function must be called once to initialize this module. This
+ has to be done before a second thread is spawned. We can't do the
+ static initialization because Pth emulation code might not be able
+ to do a static init; in particualr, it is not possible for W32. */
+void
+initialize_module_call_scd (void)
+{
+#ifdef USE_GNU_PTH
+ static int initialized;
+
+ if (!initialized)
+ if (pth_mutex_init (&scd_lock))
+ initialized = 1;
+#endif /*USE_GNU_PTH*/
+}
+
+
static int
unlock_scd (int rc)
{
@@ -163,7 +180,7 @@ unlock_scd (int rc)
if (!rc)
rc = gpg_error (GPG_ERR_INTERNAL);
}
-#endif
+#endif /*USE_GNU_PTH*/
return rc;
}