From 7b8be1222f87475b8aae1dd648aa369542d6fe70 Mon Sep 17 00:00:00 2001 From: "U-WSCHLIEP-PC\\wschliep" Date: Fri, 19 Sep 2008 18:32:49 -0400 Subject: [PATCH] irc.client: Got rid of the annoying 100% CPU --- extra/irc/client/client.factor | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) mode change 100644 => 100755 extra/irc/client/client.factor diff --git a/extra/irc/client/client.factor b/extra/irc/client/client.factor old mode 100644 new mode 100755 index 2474fd643a..76382edf1b --- a/extra/irc/client/client.factor +++ b/extra/irc/client/client.factor @@ -91,8 +91,6 @@ SYMBOL: current-irc-client : irc-send ( irc-message -- ) irc> out-messages>> mailbox-put ; : listener> ( name -- listener/f ) irc> listeners>> at ; -: maybe-mailbox-get ( mailbox quot: ( irc-message -- ) -- ) - [ dup mailbox-empty? [ drop 0.1 sleep ] ] dip '[ mailbox-get @ ] if ; inline GENERIC: to-listener ( message obj -- ) @@ -294,14 +292,14 @@ DEFER: (connect-irc) [ (reader-loop) ] [ handle-disconnect ] recover t ; : writer-loop ( -- ? ) - irc> out-messages>> [ handle-outgoing-irc ] maybe-mailbox-get t ; + irc> out-messages>> mailbox-get handle-outgoing-irc t ; ! ====================================== ! Processing loops ! ====================================== : in-multiplexer-loop ( -- ? ) - irc> in-messages>> [ handle-incoming-irc ] maybe-mailbox-get t ; + irc> in-messages>> mailbox-get handle-incoming-irc t ; : strings>privmsg ( name string -- privmsg ) privmsg new [ (>>trailing) ] keep [ (>>name) ] keep ; @@ -314,9 +312,10 @@ DEFER: (connect-irc) : listener-loop ( name -- ? ) dup listener> [ - out-messages>> [ maybe-annotate-with-name - irc> out-messages>> mailbox-put ] with - maybe-mailbox-get t + out-messages>> mailbox-get + maybe-annotate-with-name + irc> out-messages>> mailbox-put + t ] [ drop f ] if* ; : spawn-irc-loop ( quot: ( -- ? ) name -- )