[usocket-cvs] r378 - usocket/branches/new-wfi/backend

ehuelsmann at common-lisp.net ehuelsmann at common-lisp.net
Tue Jul 22 20:23:18 UTC 2008


Author: ehuelsmann
Date: Tue Jul 22 16:23:17 2008
New Revision: 378

Modified:
   usocket/branches/new-wfi/backend/armedbear.lisp
Log:
Make the ABCL backend actually adhere to the new protocol (ie update the STATE slot).

Modified: usocket/branches/new-wfi/backend/armedbear.lisp
==============================================================================
--- usocket/branches/new-wfi/backend/armedbear.lisp	(original)
+++ usocket/branches/new-wfi/backend/armedbear.lisp	Tue Jul 22 16:23:17 2008
@@ -377,7 +377,7 @@
                 ;; we actually have work to do
                 (let* ((selkeys (jdi:do-jmethod selector "selectedKeys"))
                        (selkey-iterator (jdi:do-jmethod selkeys "iterator"))
-                       ready-sockets)
+                       (%wait (wait-list-%wait wait-list)))
                   (loop while (java:jcall
                                (java:jmethod "java.util.Iterator" "hasNext")
                                (jdi:jop-deref selkey-iterator))
@@ -386,16 +386,8 @@
                                         "java.nio.channels.SelectionKey"))
                                   (chan (jdi:jop-deref
                                          (jdi:do-jmethod key "channel"))))
-                             (push chan ready-sockets)))
-                  (remove-if #'(lambda (s)
-                                 (not (member (jdi:jop-deref (socket s))
-                                              ready-sockets
-                                              :test #'(lambda (x y)
-                                                        (java:jcall (java:jmethod "java.lang.Object"
-                                                                             "equals"
-                                                                             "java.lang.Object")
-                                                                    x y)))))
-                             sockets))))))
+                             (setf (state (gethash chan %wait))
+                                   :READ))))))))
       ;; cancel all Selector registrations
       (let* ((keys (jdi:do-jmethod selector "keys"))
              (iter (jdi:do-jmethod keys "iterator")))
@@ -431,10 +423,12 @@
 ;;
 
 (defun %setup-wait-list (wl)
-  (declare (ignore wl)))
+  (setf (wait-list-%wait wl)
+        (make-hash-table :rehash-size 1.3d0)))
 
 (defun %add-waiter (wl w)
-  (declare (ignore wl w)))
+  (setf (gethash (socket w) (wait-list-%wait wl))
+        w))
 
 (defun %remove-waiter (wl w)
-  (declare (ignore wl w)))
\ No newline at end of file
+  (remhash (socket w) (wait-list-%wait wl)))
\ No newline at end of file



More information about the usocket-cvs mailing list