[svn] gpgme - r1151 - trunk/gpgme

svn author wk cvs at cvs.gnupg.org
Thu Jan 26 11:23:17 CET 2006


Author: wk
Date: 2006-01-26 11:23:15 +0100 (Thu, 26 Jan 2006)
New Revision: 1151

Modified:
   trunk/gpgme/ChangeLog
   trunk/gpgme/gpgme.h
   trunk/gpgme/posix-util.c
   trunk/gpgme/util.h
   trunk/gpgme/w32-io.c
   trunk/gpgme/w32-util.c
Log:
[W32] Add a tuning feature


Modified: trunk/gpgme/ChangeLog
===================================================================
--- trunk/gpgme/ChangeLog	2006-01-05 08:58:50 UTC (rev 1150)
+++ trunk/gpgme/ChangeLog	2006-01-26 10:23:15 UTC (rev 1151)
@@ -1,3 +1,10 @@
+2006-01-26  Werner Koch  <wk at g10code.com>
+
+	* 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  <wk at g10code.com>
 
 	* debug.h (_gpgme_debug_srcname): New. Use it with the debug macros.

Modified: trunk/gpgme/gpgme.h
===================================================================
--- trunk/gpgme/gpgme.h	2006-01-05 08:58:50 UTC (rev 1150)
+++ trunk/gpgme/gpgme.h	2006-01-26 10:23:15 UTC (rev 1151)
@@ -72,7 +72,7 @@
    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"
 
 
 

Modified: trunk/gpgme/posix-util.c
===================================================================
--- trunk/gpgme/posix-util.c	2006-01-05 08:58:50 UTC (rev 1150)
+++ trunk/gpgme/posix-util.c	2006-01-26 10:23:15 UTC (rev 1151)
@@ -48,3 +48,10 @@
   return NULL;
 #endif
 }
+
+/* See w32-util.c */
+int
+_gpgme_get_conf_int (const char *key, int *value)
+{
+  return 0;
+}

Modified: trunk/gpgme/util.h
===================================================================
--- trunk/gpgme/util.h	2006-01-05 08:58:50 UTC (rev 1150)
+++ trunk/gpgme/util.h	2006-01-26 10:23:15 UTC (rev 1151)
@@ -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 --*/

Modified: trunk/gpgme/w32-io.c
===================================================================
--- trunk/gpgme/w32-io.c	2006-01-05 08:58:50 UTC (rev 1150)
+++ trunk/gpgme/w32-io.c	2006-01-26 10:23:15 UTC (rev 1151)
@@ -119,6 +119,23 @@
 
 
 
+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 @@
       /* 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 @@
       /* 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;

Modified: trunk/gpgme/w32-util.c
===================================================================
--- trunk/gpgme/w32-util.c	2006-01-05 08:58:50 UTC (rev 1150)
+++ trunk/gpgme/w32-util.c	2006-01-26 10:23:15 UTC (rev 1151)
@@ -265,7 +265,6 @@
   return result;
 }
 
-
 const char *
 _gpgme_get_gpg_path (void)
 {
@@ -301,3 +300,18 @@
   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;
+}




More information about the Gnupg-commits mailing list