< prev index next >

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

Print this page
*** 56,12 ***
  {
      private final FileDescriptor fd;
  
      private final int fdVal;
  
!     /* IDs of native thread doing accept, for signalling */
!     private volatile long thread;
  
      /* Lock held by thread currently blocked in this channel */
      private final Object lock = new Object();
  
      /* Lock held by any thread that modifies the state fields declared below
--- 56,12 ---
  {
      private final FileDescriptor fd;
  
      private final int fdVal;
  
!     /* thread doing accept, for signalling */
!     private volatile Thread thread;
  
      /* Lock held by thread currently blocked in this channel */
      private final Object lock = new Object();
  
      /* Lock held by any thread that modifies the state fields declared below

*** 198,11 ***
          }
      }
  
      private void acceptCleanup() throws IOException {
          synchronized (stateLock) {
!             thread = 0;
              if (state == ChannelState.KILLPENDING)
                  kill();
          }
      }
  
--- 198,11 ---
          }
      }
  
      private void acceptCleanup() throws IOException {
          synchronized (stateLock) {
!             thread = null;
              if (state == ChannelState.KILLPENDING)
                  kill();
          }
      }
  

*** 220,11 ***
  
              try {
                  begin();
                  if (!isOpen())
                      return null;
!                 thread = NativeThread.current();
                  for (;;) {
                      n = Net.accept(fd, newfd, isaa);
                      if ((n == IOStatus.INTERRUPTED) && isOpen())
                          continue;
                      break;
--- 220,11 ---
  
              try {
                  begin();
                  if (!isOpen())
                      return null;
!                 thread = NativeThread.threadToSignal();
                  for (;;) {
                      n = Net.accept(fd, newfd, isaa);
                      if ((n == IOStatus.INTERRUPTED) && isOpen())
                          continue;
                      break;

*** 251,11 ***
      @Override
      public void implCloseSelectableChannel() throws IOException {
          synchronized (stateLock) {
              if (state != ChannelState.KILLED)
                  SctpNet.preClose(fdVal);
!             if (thread != 0)
                  NativeThread.signal(thread);
              if (!isRegistered())
                  kill();
          }
      }
--- 251,11 ---
      @Override
      public void implCloseSelectableChannel() throws IOException {
          synchronized (stateLock) {
              if (state != ChannelState.KILLED)
                  SctpNet.preClose(fdVal);
!             if (thread != null)
                  NativeThread.signal(thread);
              if (!isRegistered())
                  kill();
          }
      }

*** 271,11 ***
                  return;
              }
              assert !isOpen() && !isRegistered();
  
              // Postpone the kill if there is a thread in accept
!             if (thread == 0) {
                  state = ChannelState.KILLED;
                  SctpNet.close(fdVal);
              } else {
                  state = ChannelState.KILLPENDING;
              }
--- 271,11 ---
                  return;
              }
              assert !isOpen() && !isRegistered();
  
              // Postpone the kill if there is a thread in accept
!             if (thread == null) {
                  state = ChannelState.KILLED;
                  SctpNet.close(fdVal);
              } else {
                  state = ChannelState.KILLPENDING;
              }
< prev index next >