Author: nextgens
Date: 2008-06-19 09:12:31 +0000 (Thu, 19 Jun 2008)
New Revision: 20473

Modified:
   trunk/freenet/src/freenet/support/io/NativeThread.java
Log:
even better that way

Modified: trunk/freenet/src/freenet/support/io/NativeThread.java
===================================================================
--- trunk/freenet/src/freenet/support/io/NativeThread.java      2008-06-19 
09:09:02 UTC (rev 20472)
+++ trunk/freenet/src/freenet/support/io/NativeThread.java      2008-06-19 
09:12:31 UTC (rev 20473)
@@ -39,9 +39,9 @@
        static {
                Logger.minor(NativeThread.class, "Running init()");
                // Loading the NativeThread library isn't useful on macos
-               _loadNative = 
("Linux".equalsIgnoreCase(System.getProperty("os.name"))) && 
(NodeStarter.extBuildNumber > 18);
-               Logger.debug(NativeThread.class, "Run init(): should 
loadNative="+_loadNative);
-               if(_loadNative && 
LibraryLoader.loadNative("/freenet/support/io/", "NativeThread")) {
+               boolean maybeLoadNative = 
("Linux".equalsIgnoreCase(System.getProperty("os.name"))) && 
(NodeStarter.extBuildNumber > 18);
+               Logger.debug(NativeThread.class, "Run init(): should 
loadNative="+maybeLoadNative);
+               if(maybeLoadNative && 
LibraryLoader.loadNative("/freenet/support/io/", "NativeThread")) {
                        NATIVE_PRIORITY_BASE = getLinuxPriority();
                        NATIVE_PRIORITY_RANGE = 20 - NATIVE_PRIORITY_BASE;
                        System.out.println("Using the NativeThread 
implementation (base nice level is "+NATIVE_PRIORITY_BASE+')');
@@ -51,6 +51,7 @@
                        HAS_PLENTY_NICE_LEVELS = NATIVE_PRIORITY_RANGE 
>=JAVA_PRIORITY_RANGE;
                        if(!(HAS_ENOUGH_NICE_LEVELS && HAS_THREE_NICE_LEVELS))
                                System.err.println("WARNING!!! The JVM has been 
niced down to a level which won't allow it to schedule threads properly! LOWER 
THE NICE LEVEL!!");
+                       _loadNative = true;
                } else {
                        // unused anyway
                        NATIVE_PRIORITY_BASE = 0;
@@ -58,6 +59,7 @@
                        HAS_THREE_NICE_LEVELS = true;
                        HAS_ENOUGH_NICE_LEVELS = true;
                        HAS_PLENTY_NICE_LEVELS = true;
+                       _loadNative = false;
                }
                Logger.minor(NativeThread.class, "Run init(): _loadNative = 
"+_loadNative);
        }


Reply via email to