< prev index next >

src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpChannelImpl.java

Print this page
@@ -83,12 +83,12 @@
      private final FileDescriptor fd;
  
      private final int fdVal;
  
      /* IDs of native threads doing send and receive, for signalling */
-     private volatile long receiverThread;
-     private volatile long senderThread;
+     private volatile NativeThread receiverThread;
+     private volatile NativeThread senderThread;
  
      /* Lock held by current receiving or connecting thread */
      private final Object receiveLock = new Object();
  
      /* Lock held by current sending or connecting thread */

@@ -324,19 +324,19 @@
          }
      }
  
      private void receiverCleanup() throws IOException {
          synchronized (stateLock) {
-             receiverThread = 0;
+             receiverThread = null;
              if (state == ChannelState.KILLPENDING)
                  kill();
          }
      }
  
      private void senderCleanup() throws IOException {
          synchronized (stateLock) {
-             senderThread = 0;
+             senderThread = null;
              if (state == ChannelState.KILLPENDING)
                  kill();
          }
      }
  

@@ -482,11 +482,11 @@
                                  } while (!connected && isOpen());
                              }
                          }
                      } finally {
                          synchronized (stateLock) {
-                             receiverThread = 0;
+                             receiverThread = null;
                              if (state == ChannelState.KILLPENDING) {
                                  kill();
                                  connected = false;
                              }
                          }

@@ -539,15 +539,15 @@
      public void implCloseSelectableChannel() throws IOException {
          synchronized (stateLock) {
              if (state != ChannelState.KILLED)
                  SctpNet.preClose(fdVal);
  
-             if (receiverThread != 0)
-                 NativeThread.signal(receiverThread);
+             if (NativeThread.isNativeThread(receiverThread))
+                 receiverThread.signal();
  
-             if (senderThread != 0)
-                 NativeThread.signal(senderThread);
+             if (NativeThread.isNativeThread(senderThread))
+                 senderThread.signal();
  
              if (!isRegistered())
                  kill();
          }
      }

@@ -642,11 +642,11 @@
              }
              assert !isOpen() && !isRegistered();
  
              /* Postpone the kill if there is a waiting reader
               * or writer thread. */
-             if (receiverThread == 0 && senderThread == 0) {
+             if (receiverThread == null && senderThread == null) {
                  state = ChannelState.KILLED;
                  SctpNet.close(fdVal);
              } else {
                  state = ChannelState.KILLPENDING;
              }

@@ -1029,12 +1029,12 @@
              if (isShutdown)
                  return this;
  
              ensureSendOpen();
              SctpNet.shutdown(fdVal, -1);
-             if (senderThread != 0)
-                 NativeThread.signal(senderThread);
+             if (NativeThread.isNativeThread(senderThread))
+                 senderThread.signal();
              isShutdown = true;
          }
          return this;
      }
  
< prev index next >