< prev index next >

src/java.base/unix/classes/sun/nio/ch/SinkChannelImpl.java

Print this page
@@ -62,11 +62,11 @@
      private static final int ST_CLOSING = 1;
      private static final int ST_CLOSED = 2;
      private int state;
  
      // ID of native thread doing write, for signalling
-     private long thread;
+     private NativeThread writer;
  
      // True if the channel's socket has been forced into non-blocking mode
      // by a virtual thread. It cannot be reset. When the channel is in
      // blocking mode and the channel's socket is in non-blocking mode then
      // operations that don't complete immediately will poll the socket and

@@ -118,11 +118,11 @@
       * Closes the write end of the pipe if there are no write operation in
       * progress and the channel is not registered with a Selector.
       */
      private boolean tryClose() throws IOException {
          assert Thread.holdsLock(stateLock) && state == ST_CLOSING;
-         if (thread == 0 && !isRegistered()) {
+         if (writer == null && !isRegistered()) {
              state = ST_CLOSED;
              nd.close(fd);
              return true;
          } else {
              return false;

@@ -150,11 +150,11 @@
      private void implCloseBlockingMode() throws IOException {
          synchronized (stateLock) {
              assert state < ST_CLOSING;
              state = ST_CLOSING;
              if (!tryClose()) {
-                 nd.preClose(fd, thread, 0);
+                 nd.preClose(fd, null, writer);
              }
          }
      }
  
      /**

@@ -268,11 +268,11 @@
              begin();
          }
          synchronized (stateLock) {
              ensureOpen();
              if (blocking)
-                 thread = NativeThread.current();
+                 writer = NativeThread.current();
          }
      }
  
      /**
       * Marks the end of a write operation that may have blocked.

@@ -283,11 +283,11 @@
      private void endWrite(boolean blocking, boolean completed)
          throws AsynchronousCloseException
      {
          if (blocking) {
              synchronized (stateLock) {
-                 thread = 0;
+                 writer = null;
                  if (state == ST_CLOSING) {
                      tryFinishClose();
                  }
              }
              // remove hook for Thread.interrupt
< prev index next >