< prev index next >

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

Print this page
*** 57,11 ***
      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
--- 57,11 ---
      private final FileDescriptor fd;
  
      private final int fdVal;
  
      /* IDs of native thread doing accept, for signalling */
!     private volatile NativeThread 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();
          }
      }
  

*** 251,12 ***
      @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,12 ---
      @Override
      public void implCloseSelectableChannel() throws IOException {
          synchronized (stateLock) {
              if (state != ChannelState.KILLED)
                  SctpNet.preClose(fdVal);
!             if (NativeThread.isNativeThread(thread))
!                 thread.signal();
              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 >