< prev index next >

src/java.base/windows/classes/sun/nio/ch/NativeThread.java

Print this page

        

@@ -26,17 +26,36 @@
 package sun.nio.ch;
 
 
 // Signalling operations on native threads
 
+import jdk.internal.misc.Strands;
 
 class NativeThread {
+    private static final long FIBER_ID = -1L;
 
     static long current() {
-        // return 0 to ensure that async close of blocking sockets will close
-        // the underlying socket.
+        Object s = Strands.currentStrand();
+        if (s instanceof Fiber) {
+            return FIBER_ID;
+        } else {
+            return 0;
+        }
+    }
+
+    static long currentKernelThread() {
         return 0;
     }
 
-    static void signal(long nt) { }
+    static void signal(long tid) {
+        throw new UnsupportedOperationException();
+    }
+
+    static boolean isFiber(long tid) {
+        return (tid == FIBER_ID);
+    }
+
+    static boolean isKernelThread(long tid) {
+        return false;
+    }
 
 }
< prev index next >