Showing the changes to java (2 of 2 files). Show all
Unified · Split
| @@ -145,11 +145,16 @@ class Thread implements Runnable { · 144 unmodified lines | |||
| 145 | 145 | ||
| 146 | private char name[]; | 146 | private char name[]; |
| 147 | private int priority; | 147 | private int priority; |
| 148 | private Thread threadQ; | 148 | // [Inferno] < |
| 149 | private long eetop; | 149 | //private Thread threadQ; |
| 150 | //private long eetop; | ||
| 151 | // [Inferno] = | ||
| 152 | private Object PrivateInfo; | ||
| 153 | private boolean was_interrupted; | ||
| 154 | // [Inferno] > | ||
| 150 | 155 | ||
| 151 | /* Whether or not to single_step this thread. */ | 156 | /* Whether or not to single_step this thread. */ |
| 152 | private boolean single_step; | 157 | // [Inferno] // private boolean single_step; |
| 153 | 158 | ||
| 154 | /* Whether or not the thread is a daemon thread. */ | 159 | /* Whether or not the thread is a daemon thread. */ |
| 155 | private boolean daemon = false; | 160 | private boolean daemon = false; |
| @@ -2032,4 +2037,41 @@ class Thread implements Runnable { · 1876 unmodified lines | |||
| 2032 | private native void suspend0(); | 2037 | private native void suspend0(); |
| 2033 | private native void resume0(); | 2038 | private native void resume0(); |
| 2034 | private native void interrupt0(); | 2039 | private native void interrupt0(); |
| 2040 | |||
| 2041 | // [Inferno] < | ||
| 2042 | private native static void lowinit(Thread thd); | ||
| 2043 | |||
| 2044 | // | ||
| 2045 | // this constructor is only used for the creation of the root | ||
| 2046 | // thread. This root thread is special, as it is already running. | ||
| 2047 | // The parameter is only there to make the constructor unique from | ||
| 2048 | // the public constructors. | ||
| 2049 | // | ||
| 2050 | private Thread( int i ) | ||
| 2051 | { | ||
| 2052 | if ( threadInitNumber != 0 ) | ||
| 2053 | throw new InternalError( "redundant root thread creation" ); | ||
| 2054 | |||
| 2055 | name = new char[] {'m','a','i','n'}; | ||
| 2056 | priority = NORM_PRIORITY; | ||
| 2057 | daemon = false; | ||
| 2058 | stillborn = false; | ||
| 2059 | target = null; | ||
| 2060 | group = null; //this is set later | ||
| 2061 | PrivateInfo = null; //set later to lowerlevel structure | ||
| 2062 | } | ||
| 2063 | |||
| 2064 | static | ||
| 2065 | { | ||
| 2066 | // create the "first" thread object and | ||
| 2067 | // associate it with the thread executing | ||
| 2068 | // this initializer. | ||
| 2069 | threadInitNumber = 0; //0 is reserved | ||
| 2070 | Thread thd = new Thread(0); // use private constructor | ||
| 2071 | lowinit(thd); | ||
| 2072 | thd.group.add(thd); | ||
| 2073 | threadInitNumber = 1; //next thread id | ||
| 2074 | } | ||
| 2075 | |||
| 2076 | // [Inferno] > | ||
| 2035 | } | 2077 | } |
| @@ -80,14 +80,37 @@ public class ThreadLocal<T> { · 79 unmodified lines | |||
| 80 | * are used by the same threads, while remaining well-behaved in | 80 | * are used by the same threads, while remaining well-behaved in |
| 81 | * less common cases. | 81 | * less common cases. |
| 82 | */ | 82 | */ |
| 83 | // [Inferno] < | ||
| 84 | //private final int threadLocalHashCode = nextHashCode(); | ||
| 85 | // | ||
| 86 | ///** | ||
| 87 | // * The next hash code to be given out. Updated atomically. Starts at | ||
| 88 | // * zero. | ||
| 89 | // */ | ||
| 90 | //private static AtomicInteger nextHashCode = | ||
| 91 | // new AtomicInteger(); | ||
| 92 | // | ||
| 93 | ///** | ||
| 94 | // * The difference between successively generated hash codes - turns | ||
| 95 | // * implicit sequential thread-local IDs into near-optimally spread | ||
| 96 | // * multiplicative hash values for power-of-two-sized tables. | ||
| 97 | // */ | ||
| 98 | //private static final int HASH_INCREMENT = 0x61c88647; | ||
| 99 | // | ||
| 100 | ///** | ||
| 101 | // * Returns the next hash code. | ||
| 102 | // */ | ||
| 103 | //private static int nextHashCode() { | ||
| 104 | // return nextHashCode.getAndAdd(HASH_INCREMENT); | ||
| 105 | //} | ||
| 106 | // ================ | ||
| 83 | private final int threadLocalHashCode = nextHashCode(); | 107 | private final int threadLocalHashCode = nextHashCode(); |
| 84 | 108 | ||
| 85 | /** | 109 | /** |
| 86 | * The next hash code to be given out. Updated atomically. Starts at | 110 | * The next hash code to be given out. Updated atomically. Starts at |
| 87 | * zero. | 111 | * zero. |
| 88 | */ | 112 | */ |
| 89 | private static AtomicInteger nextHashCode = | 113 | private static int nextHashCode = 0; |
| 90 | new AtomicInteger(); | ||
| 91 | 114 | ||
| 92 | /** | 115 | /** |
| 93 | * The difference between successively generated hash codes - turns | 116 | * The difference between successively generated hash codes - turns |
| @@ -100,7 +123,7 @@ public class ThreadLocal<T> { · 6 unmodified lines | |||
| 100 | * Returns the next hash code. | 123 | * Returns the next hash code. |
| 101 | */ | 124 | */ |
| 102 | private static int nextHashCode() { | 125 | private static int nextHashCode() { |
| 103 | return nextHashCode.getAndAdd(HASH_INCREMENT); | 126 | return nextHashCode += HASH_INCREMENT; |
| 104 | } | 127 | } |
| 105 | 128 | ||
| 106 | /** | 129 | /** |