diff options
| author | membar <membar@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-12-20 15:33:24 +0000 |
|---|---|---|
| committer | membar <membar@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-12-20 15:33:24 +0000 |
| commit | 1ecab59d81ab572e0877e9d816bd1b5f17994bde (patch) | |
| tree | b5bed309c7a6e581e386dd9be0e16fa13651636b /libjava/java/nio/channels/spi/AbstractSelector.java | |
| parent | 1f2cc95080eb6abc3a667c35f0eee0d9d1e57e25 (diff) | |
| download | ppe42-gcc-1ecab59d81ab572e0877e9d816bd1b5f17994bde.tar.gz ppe42-gcc-1ecab59d81ab572e0877e9d816bd1b5f17994bde.zip | |
* gnu/java/nio/SelectorImpl.java
(selectThreadMutex): New field.
(selectThread): New field.
(unhandledWakeup): New field.
(implCloseSelector): Added skeleton code which
synchronizes as per Sun JRE JavaDoc.
(keys): Throw ClosedSelectorException if selector
is closed.
(selectNow): Added comment that we're faking out
an immediate select with a one-microsecond-timeout one.
(select): Use 0 instead of -1 for infinite timeout.
(implSelect): Changed comment in declaration.
(select): Added synchronized to method declaration.
Added synchronization and wakeup support as per Sun
JRE JavaDoc.
(selectedKeys): Throw ClosedSelectorException if selector
is closed.
(wakeup): Implemented.
(deregisterCancelledKeys): Synchronize on cancelled key
set before deregistering.
(register): Synchronize on key set before registering.
* java/nio/channels/spi/AbstractSelector.java
Added import for java.nio.channels.ClosedSelectorException.
(close): Added synchronized to method declaration.
(cancelledKeys): Throw ClosedSelectorException if selector
is closed.
(cancelKey): Synchronize on cancelled key set before key.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74879 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/nio/channels/spi/AbstractSelector.java')
| -rw-r--r-- | libjava/java/nio/channels/spi/AbstractSelector.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libjava/java/nio/channels/spi/AbstractSelector.java b/libjava/java/nio/channels/spi/AbstractSelector.java index 58ce0c84f60..ca7718733d7 100644 --- a/libjava/java/nio/channels/spi/AbstractSelector.java +++ b/libjava/java/nio/channels/spi/AbstractSelector.java @@ -39,6 +39,7 @@ exception statement from your version. */ package java.nio.channels.spi; import java.io.IOException; +import java.nio.channels.ClosedSelectorException; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.util.Set; @@ -64,7 +65,7 @@ public abstract class AbstractSelector extends Selector * * @exception IOException If an error occurs */ - public final void close () throws IOException + public final synchronized void close () throws IOException { if (closed) return; @@ -102,12 +103,18 @@ public abstract class AbstractSelector extends Selector protected final Set cancelledKeys() { + if (!isOpen()) + throw new ClosedSelectorException(); + return cancelledKeys; } final void cancelKey (AbstractSelectionKey key) { - cancelledKeys.remove (key); + synchronized (cancelledKeys) + { + cancelledKeys.remove(key); + } } /** |

