1.1 --- a/rt/emul/compact/src/main/java/java/util/concurrent/locks/LockSupport.java Sat Mar 19 10:46:31 2016 +0100
1.2 +++ b/rt/emul/compact/src/main/java/java/util/concurrent/locks/LockSupport.java Sat Mar 19 11:01:40 2016 +0100
1.3 @@ -34,8 +34,6 @@
1.4 */
1.5
1.6 package java.util.concurrent.locks;
1.7 -import java.util.concurrent.*;
1.8 -import sun.misc.Unsafe;
1.9
1.10
1.11 /**
1.12 @@ -120,22 +118,6 @@
1.13 public class LockSupport {
1.14 private LockSupport() {} // Cannot be instantiated.
1.15
1.16 - // Hotspot implementation via intrinsics API
1.17 - private static final Unsafe unsafe = Unsafe.getUnsafe();
1.18 - private static final long parkBlockerOffset;
1.19 -
1.20 - static {
1.21 - try {
1.22 - parkBlockerOffset = unsafe.objectFieldOffset
1.23 - (java.lang.Thread.class.getDeclaredField("parkBlocker"));
1.24 - } catch (Exception ex) { throw new Error(ex); }
1.25 - }
1.26 -
1.27 - private static void setBlocker(Thread t, Object arg) {
1.28 - // Even though volatile, hotspot doesn't need a write barrier here.
1.29 - unsafe.putObject(t, parkBlockerOffset, arg);
1.30 - }
1.31 -
1.32 /**
1.33 * Makes available the permit for the given thread, if it
1.34 * was not already available. If the thread was blocked on
1.35 @@ -148,8 +130,6 @@
1.36 * this operation has no effect
1.37 */
1.38 public static void unpark(Thread thread) {
1.39 - if (thread != null)
1.40 - unsafe.unpark(thread);
1.41 }
1.42
1.43 /**
1.44 @@ -181,10 +161,6 @@
1.45 * @since 1.6
1.46 */
1.47 public static void park(Object blocker) {
1.48 - Thread t = Thread.currentThread();
1.49 - setBlocker(t, blocker);
1.50 - unsafe.park(false, 0L);
1.51 - setBlocker(t, null);
1.52 }
1.53
1.54 /**
1.55 @@ -220,12 +196,6 @@
1.56 * @since 1.6
1.57 */
1.58 public static void parkNanos(Object blocker, long nanos) {
1.59 - if (nanos > 0) {
1.60 - Thread t = Thread.currentThread();
1.61 - setBlocker(t, blocker);
1.62 - unsafe.park(false, nanos);
1.63 - setBlocker(t, null);
1.64 - }
1.65 }
1.66
1.67 /**
1.68 @@ -262,10 +232,6 @@
1.69 * @since 1.6
1.70 */
1.71 public static void parkUntil(Object blocker, long deadline) {
1.72 - Thread t = Thread.currentThread();
1.73 - setBlocker(t, blocker);
1.74 - unsafe.park(true, deadline);
1.75 - setBlocker(t, null);
1.76 }
1.77
1.78 /**
1.79 @@ -281,9 +247,7 @@
1.80 * @since 1.6
1.81 */
1.82 public static Object getBlocker(Thread t) {
1.83 - if (t == null)
1.84 - throw new NullPointerException();
1.85 - return unsafe.getObjectVolatile(t, parkBlockerOffset);
1.86 + return null;
1.87 }
1.88
1.89 /**
1.90 @@ -312,7 +276,6 @@
1.91 * for example, the interrupt status of the thread upon return.
1.92 */
1.93 public static void park() {
1.94 - unsafe.park(false, 0L);
1.95 }
1.96
1.97 /**
1.98 @@ -345,8 +308,6 @@
1.99 * @param nanos the maximum number of nanoseconds to wait
1.100 */
1.101 public static void parkNanos(long nanos) {
1.102 - if (nanos > 0)
1.103 - unsafe.park(false, nanos);
1.104 }
1.105
1.106 /**
1.107 @@ -380,6 +341,5 @@
1.108 * to wait until
1.109 */
1.110 public static void parkUntil(long deadline) {
1.111 - unsafe.park(true, deadline);
1.112 }
1.113 }