[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r1710 - GNUnet/src/util
From: |
grothoff |
Subject: |
[GNUnet-SVN] r1710 - GNUnet/src/util |
Date: |
Tue, 16 Aug 2005 23:22:13 -0700 (PDT) |
Author: grothoff
Date: 2005-08-16 23:22:12 -0700 (Tue, 16 Aug 2005)
New Revision: 1710
Modified:
GNUnet/src/util/initialize.c
Log:
leak
Modified: GNUnet/src/util/initialize.c
===================================================================
--- GNUnet/src/util/initialize.c 2005-08-17 06:11:47 UTC (rev 1709)
+++ GNUnet/src/util/initialize.c 2005-08-17 06:22:12 UTC (rev 1710)
@@ -102,70 +102,75 @@
* Set our process priority
*/
void setProcessPrio() {
- char *str;
- int prio = 0;
-
- /* Get setting as string */
- str = getConfigurationString(testConfigurationString("GNUNETD",
"_MAGIC_", "YES") ?
- "GNUNETD" : "GNUNET", "PROCESS-PRIORITY");
- if (str) {
- /* We support four levels (NORMAL, ABOVE NORMAL, BELOW NORMAL,
HIGH and IDLE)
- * and the usual numeric nice() increments */
- if (strcmp(str, "NORMAL") == 0)
+ char *str;
+ int prio = 0;
+
+ /* Get setting as string */
+ str = getConfigurationString(testConfigurationString("GNUNETD",
+ "_MAGIC_",
+ "YES")
+ ? "GNUNETD"
+ : "GNUNET",
+ "PROCESS-PRIORITY");
+ if (str) {
+ /* We support four levels (NORMAL, ABOVE NORMAL, BELOW NORMAL, HIGH and
IDLE)
+ * and the usual numeric nice() increments */
+ if (strcmp(str, "NORMAL") == 0)
#ifdef MINGW
- prio = NORMAL_PRIORITY_CLASS;
+ prio = NORMAL_PRIORITY_CLASS;
#else
- prio = 0;
+ prio = 0;
#endif
- else if (strcmp(str, "ABOVE NORMAL") == 0)
+ else if (strcmp(str, "ABOVE NORMAL") == 0)
#ifdef MINGW
- prio = ABOVE_NORMAL_PRIORITY_CLASS;
+ prio = ABOVE_NORMAL_PRIORITY_CLASS;
#else
- prio = -10;
+ prio = -10;
#endif
- else if (strcmp(str, "BELOW NORMAL") == 0)
+ else if (strcmp(str, "BELOW NORMAL") == 0)
#ifdef MINGW
- prio = BELOW_NORMAL_PRIORITY_CLASS;
+ prio = BELOW_NORMAL_PRIORITY_CLASS;
#else
- prio = 10;
+ prio = 10;
#endif
- else if (strcmp(str, "HIGH") == 0)
+ else if (strcmp(str, "HIGH") == 0)
#ifdef MINGW
- prio = HIGH_PRIORITY_CLASS;
+ prio = HIGH_PRIORITY_CLASS;
#else
- prio = -20;
+ prio = -20;
#endif
- else if (strcmp(str, "IDLE") == 0)
+ else if (strcmp(str, "IDLE") == 0)
#ifdef MINGW
- prio = IDLE_PRIORITY_CLASS;
+ prio = IDLE_PRIORITY_CLASS;
#else
- prio = 19;
+ prio = 19;
#endif
- else {
- prio = atoi(str);
-
+ else {
+ prio = atoi(str);
+
#ifdef MINGW
- /* Convert the nice increment to a priority class */
- if (prio == 0)
- prio = NORMAL_PRIORITY_CLASS;
- else if (prio > 0 && prio <= 10)
- prio = BELOW_NORMAL_PRIORITY_CLASS;
- else if (prio > 0)
- prio = IDLE_PRIORITY_CLASS;
- else if (prio < 0 && prio >= -10)
- prio = ABOVE_NORMAL_PRIORITY_CLASS;
- else if (prio < 0)
- prio = HIGH_PRIORITY_CLASS;
+ /* Convert the nice increment to a priority class */
+ if (prio == 0)
+ prio = NORMAL_PRIORITY_CLASS;
+ else if (prio > 0 && prio <= 10)
+ prio = BELOW_NORMAL_PRIORITY_CLASS;
+ else if (prio > 0)
+ prio = IDLE_PRIORITY_CLASS;
+ else if (prio < 0 && prio >= -10)
+ prio = ABOVE_NORMAL_PRIORITY_CLASS;
+ else if (prio < 0)
+ prio = HIGH_PRIORITY_CLASS;
#endif
- }
-
- /* Set process priority */
+ }
+
+ /* Set process priority */
#ifdef MINGW
- SetPriorityClass(GetCurrentProcess(), prio);
+ SetPriorityClass(GetCurrentProcess(), prio);
#else
- nice(prio);
+ nice(prio);
#endif
- }
+ FREE(str);
+ }
}
/**
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r1710 - GNUnet/src/util,
grothoff <=