diff options
| author | Tom Tromey <tromey@redhat.com> | 2006-07-31 22:08:00 +0000 |
|---|---|---|
| committer | Tom Tromey <tromey@redhat.com> | 2006-07-31 22:08:00 +0000 |
| commit | 7e43c6663c112b8c6bbd110f659ca7e6859645a6 (patch) | |
| tree | 2eaf377102db65500c0cb0cab9137088caf6acf8 /gnu/java/nio/SelectionKeyImpl.java | |
| parent | 40393c2672e593e85b04d97c7ab9ff66b1b4beb1 (diff) | |
| download | classpath-7e43c6663c112b8c6bbd110f659ca7e6859645a6.tar.gz | |
PR libgcj/23682:
* java/nio/channels/SelectionKey.java (attach): Now synchronized.
(attachment): Likewise.
* java/nio/channels/spi/AbstractSelectionKey.java (cancel): Now
synchronized.
(isValid): Likewise.
* gnu/java/nio/SelectionKeyImpl.java (impl): Now final
(ch): Likewise.
(interestOps): Synchronize.
(readyOps): Likewise.
* gnu/java/nio/SelectorImpl.java (register): Synchronize around
interestOps call.
Diffstat (limited to 'gnu/java/nio/SelectionKeyImpl.java')
| -rw-r--r-- | gnu/java/nio/SelectionKeyImpl.java | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/gnu/java/nio/SelectionKeyImpl.java b/gnu/java/nio/SelectionKeyImpl.java index a1f125e9f..8745377c5 100644 --- a/gnu/java/nio/SelectionKeyImpl.java +++ b/gnu/java/nio/SelectionKeyImpl.java @@ -1,5 +1,5 @@ /* SelectionKeyImpl.java -- - Copyright (C) 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -47,8 +47,8 @@ public abstract class SelectionKeyImpl extends AbstractSelectionKey { private int readyOps; private int interestOps; - private SelectorImpl impl; - SelectableChannel ch; + private final SelectorImpl impl; + final SelectableChannel ch; public SelectionKeyImpl (SelectableChannel ch, SelectorImpl impl) { @@ -61,7 +61,7 @@ public abstract class SelectionKeyImpl extends AbstractSelectionKey return ch; } - public int readyOps () + public synchronized int readyOps () { if (!isValid()) throw new CancelledKeyException(); @@ -69,7 +69,7 @@ public abstract class SelectionKeyImpl extends AbstractSelectionKey return readyOps; } - public SelectionKey readyOps (int ops) + public synchronized SelectionKey readyOps (int ops) { if (!isValid()) throw new CancelledKeyException(); @@ -83,15 +83,21 @@ public abstract class SelectionKeyImpl extends AbstractSelectionKey if (!isValid()) throw new CancelledKeyException(); - return interestOps; + synchronized (impl.selectedKeys()) + { + return interestOps; + } } public SelectionKey interestOps (int ops) { if (!isValid()) throw new CancelledKeyException(); - - interestOps = ops; + + synchronized (impl.selectedKeys()) + { + interestOps = ops; + } return this; } |
