bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/24864] New: All keys added to selectedKeys by select() an


From: john dot zigman at anu dot edu dot au
Subject: [Bug classpath/24864] New: All keys added to selectedKeys by select() and incorrect return value
Date: 14 Nov 2005 23:12:26 -0000

Performing a select, via the gnu.java.nio.SelectorImpl.select() method:
1) Adds all keys to the selected set as the following code is executed for
every key:

                // If key is not yet selected add it.
                if (!selected.contains (key))
                  {
                    selected.add (key);
                  }

                // Set new ready ops
                key.readyOps (key.interestOps () & ops);

irrespective of whether the file descriptor for key is in either the read or
write selector set on return from VMSelector.select(...).

2) It is unclear what the return value of VMSelector.select(...) is but I
assume that it would be inline with the posix select in which the total number
of file descriptors in the read plus write plus exception this contrasts with
the java.nio.Selector.select() which should return the "total number of keys
whose ready sets were updated".

3) The way the selector is written is O(n^2), it might be better to have a
HashMap of FileDescriptors to Keys in order to update reduce the cost for large
select sets.


-- 
           Summary: All keys added to selectedKeys by select() and incorrect
                    return value
           Product: classpath
           Version: 0.19
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: classpath
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: john dot zigman at anu dot edu dot au


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24864





reply via email to

[Prev in Thread] Current Thread [Next in Thread]