aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2006-01-26 10:23:15 +0000
committerWerner Koch <[email protected]>2006-01-26 10:23:15 +0000
commit419fc378e4f3cdf33fd640a2898d83657403209d (patch)
tree5fe09c003f3be2441d25ef1aef4d5ee27d144493
parentMinor glib fix. (diff)
downloadgpgme-419fc378e4f3cdf33fd640a2898d83657403209d.tar.gz
gpgme-419fc378e4f3cdf33fd640a2898d83657403209d.zip
[W32] Add a tuning feature
Diffstat (limited to '')
-rw-r--r--gpgme/ChangeLog7
-rw-r--r--gpgme/gpgme.h2
-rw-r--r--gpgme/posix-util.c7
-rw-r--r--gpgme/util.h1
-rw-r--r--gpgme/w32-io.c21
-rw-r--r--gpgme/w32-util.c16
6 files changed, 50 insertions, 4 deletions
diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog
index 6996bd7f..0ba8de51 100644
--- a/gpgme/ChangeLog
+++ b/gpgme/ChangeLog
@@ -1,3 +1,10 @@
+2006-01-26 Werner Koch <[email protected]>
+
+ * w32-util.c (_gpgme_get_conf_int): New.
+ * posix-util.c (_gpgme_get_conf_int): New.
+ * w32-io.c (get_desired_thread_priority): New.
+ (create_reader, create_writer): Use it here.
+
2006-01-04 Werner Koch <[email protected]>
* debug.h (_gpgme_debug_srcname): New. Use it with the debug macros.
diff --git a/gpgme/gpgme.h b/gpgme/gpgme.h
index 40ca9aa7..f0fee7c0 100644
--- a/gpgme/gpgme.h
+++ b/gpgme/gpgme.h
@@ -72,7 +72,7 @@ extern "C" {
AM_PATH_GPGME macro) check that this header matches the installed
library. Warning: Do not edit the next line. configure will do
that for you! */
-#define GPGME_VERSION "1.1.1-cvs1149"
+#define GPGME_VERSION "1.1.1-cvs1150"
diff --git a/gpgme/posix-util.c b/gpgme/posix-util.c
index 45bfa5de..d5b4172d 100644
--- a/gpgme/posix-util.c
+++ b/gpgme/posix-util.c
@@ -48,3 +48,10 @@ _gpgme_get_gpgsm_path (void)
return NULL;
#endif
}
+
+/* See w32-util.c */
+int
+_gpgme_get_conf_int (const char *key, int *value)
+{
+ return 0;
+}
diff --git a/gpgme/util.h b/gpgme/util.h
index 3c724cad..28d5e192 100644
--- a/gpgme/util.h
+++ b/gpgme/util.h
@@ -31,6 +31,7 @@
/*-- {posix,w32}-util.c --*/
const char *_gpgme_get_gpg_path (void);
const char *_gpgme_get_gpgsm_path (void);
+int _gpgme_get_conf_int (const char *key, int *value);
/*-- replacement functions in <funcname>.c --*/
diff --git a/gpgme/w32-io.c b/gpgme/w32-io.c
index fd83e531..13042afc 100644
--- a/gpgme/w32-io.c
+++ b/gpgme/w32-io.c
@@ -119,6 +119,23 @@ DEFINE_STATIC_LOCK (writer_table_lock);
+static int
+get_desired_thread_priority (void)
+{
+ int value;
+
+ if (!_gpgme_get_conf_int ("IOThreadPriority", &value))
+ {
+ value = THREAD_PRIORITY_HIGHEST;
+ DEBUG1 ("** Using standard IOThreadPriority of %d\n", value);
+ }
+ else
+ DEBUG1 ("** Configured IOThreadPriority is %d\n", value);
+
+ return value;
+}
+
+
static HANDLE
set_synchronize (HANDLE h)
{
@@ -266,7 +283,7 @@ create_reader (HANDLE fd)
/* We set the priority of the thread higher because we know that
it only runs for a short time. This greatly helps to increase
the performance of the I/O. */
- SetThreadPriority (c->thread_hd, THREAD_PRIORITY_HIGHEST);
+ SetThreadPriority (c->thread_hd, get_desired_thread_priority ());
}
return c;
@@ -524,7 +541,7 @@ create_writer (HANDLE fd)
/* We set the priority of the thread higher because we know that
it only runs for a short time. This greatly helps to increase
the performance of the I/O. */
- SetThreadPriority (c->thread_hd, THREAD_PRIORITY_HIGHEST);
+ SetThreadPriority (c->thread_hd, get_desired_thread_priority ());
}
return c;
diff --git a/gpgme/w32-util.c b/gpgme/w32-util.c
index fa1a6d7a..889a6ec1 100644
--- a/gpgme/w32-util.c
+++ b/gpgme/w32-util.c
@@ -265,7 +265,6 @@ find_program_at_standard_place (const char *name)
return result;
}
-
const char *
_gpgme_get_gpg_path (void)
{
@@ -301,3 +300,18 @@ _gpgme_get_gpgsm_path (void)
UNLOCK (get_path_lock);
return gpgsm_program;
}
+
+
+/* Return an integer value from gpgme specific configuration
+ entries. VALUE receives that value; function returns true if a value
+ has been configured and false if not. */
+int
+_gpgme_get_conf_int (const char *key, int *value)
+{
+ char *tmp = read_w32_registry_string (NULL, "Software\\GNU\\gpgme", key);
+ if (!tmp)
+ return 0;
+ *value = atoi (tmp);
+ free (tmp);
+ return 1;
+}