protected void implCloseSelectableChannel() throws IOException {
   synchronized (stateLock) {
     if (state != ST_KILLED) nd.preClose(fd);
     long th = thread;
     if (th != 0) NativeThread.signal(th);
     if (!isRegistered()) kill();
   }
 }
 public void kill() throws IOException {
   synchronized (stateLock) {
     if (state == ST_KILLED) return;
     if (state == ST_UNINITIALIZED) {
       state = ST_KILLED;
       return;
     }
     assert !isOpen() && !isRegistered();
     nd.close(fd);
     state = ST_KILLED;
   }
 }