equal
deleted
inserted
replaced
1057 |
1057 |
1058 public boolean translateAndSetReadyOps(int ops, SelectionKeyImpl sk) { |
1058 public boolean translateAndSetReadyOps(int ops, SelectionKeyImpl sk) { |
1059 return translateReadyOps(ops, 0, sk); |
1059 return translateReadyOps(ops, 0, sk); |
1060 } |
1060 } |
1061 |
1061 |
|
1062 // package-private |
|
1063 int poll(int events, long timeout) throws IOException { |
|
1064 assert Thread.holdsLock(blockingLock()) && !isBlocking(); |
|
1065 |
|
1066 synchronized (readLock) { |
|
1067 int n = 0; |
|
1068 try { |
|
1069 begin(); |
|
1070 synchronized (stateLock) { |
|
1071 if (!isOpen()) |
|
1072 return 0; |
|
1073 readerThread = NativeThread.current(); |
|
1074 } |
|
1075 n = Net.poll(fd, events, timeout); |
|
1076 } finally { |
|
1077 readerThread = 0; |
|
1078 end(n > 0); |
|
1079 } |
|
1080 return n; |
|
1081 } |
|
1082 } |
|
1083 |
1062 /** |
1084 /** |
1063 * Translates an interest operation set into a native poll event set |
1085 * Translates an interest operation set into a native poll event set |
1064 */ |
1086 */ |
1065 public void translateAndSetInterestOps(int ops, SelectionKeyImpl sk) { |
1087 public void translateAndSetInterestOps(int ops, SelectionKeyImpl sk) { |
1066 int newOps = 0; |
1088 int newOps = 0; |