fix
authorChristian Grothoff <christian@grothoff.org>
Mon, 19 Apr 2010 10:39:50 +0000 (10:39 +0000)
committerChristian Grothoff <christian@grothoff.org>
Mon, 19 Apr 2010 10:39:50 +0000 (10:39 +0000)
src/util/os_priority.c
src/util/test_os_priority.c

index e57d11d63f4a985cab664c5aeb72617163b18172..b0f2b31294ea187d90a5b059f313f0fd4f36c9e1 100644 (file)
@@ -125,8 +125,8 @@ GNUNET_OS_set_process_priority (pid_t proc,
       have = nice (0);
       delta = rprio - have;
       errno = 0;
-      if ( (rprio != 0) &&
-          (-1 == nice (delta)) && 
+      if ( (delta != 0) &&
+          (rprio == nice (delta)) && 
           (errno != 0) )
         {
           GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING |
index 8284af5b86f79895cee838f327f60baa976a5b88..ab0aba33de06e077762687aec7d0ff661b0ceea2 100644 (file)
@@ -35,6 +35,26 @@ testprio ()
       GNUNET_OS_set_process_priority (getpid (),
                                       GNUNET_SCHEDULER_PRIORITY_DEFAULT))
     return 1;
+  if (GNUNET_OK !=
+      GNUNET_OS_set_process_priority (getpid (),
+                                      GNUNET_SCHEDULER_PRIORITY_UI))
+    return 1;
+  if (GNUNET_OK !=
+      GNUNET_OS_set_process_priority (getpid (),
+                                      GNUNET_SCHEDULER_PRIORITY_IDLE))
+    return 1;
+  if (GNUNET_OK !=
+      GNUNET_OS_set_process_priority (getpid (),
+                                      GNUNET_SCHEDULER_PRIORITY_BACKGROUND))
+    return 1;
+  if (GNUNET_OK !=
+      GNUNET_OS_set_process_priority (getpid (),
+                                      GNUNET_SCHEDULER_PRIORITY_HIGH))
+    return 1;
+  if (GNUNET_OK !=
+      GNUNET_OS_set_process_priority (getpid (),
+                                      GNUNET_SCHEDULER_PRIORITY_HIGH))
+    return 1;
 #ifndef MINGW
   child = fork ();
   if (child == 0)