# HG changeset patch # User Steve Losh # Date 1314398445 14400 # Node ID 4c1055d7237745fd9f581c5a88218086912271d5 # Parent cb2d6c82204ae5fabdb84673692b11ce6811cb6a Hurr durr. Hurr. diff -r cb2d6c82204a -r 4c1055d72377 src/clojurecraft/events.clj --- a/src/clojurecraft/events.clj Fri Aug 26 18:37:57 2011 -0400 +++ b/src/clojurecraft/events.clj Fri Aug 26 18:40:45 2011 -0400 @@ -23,19 +23,3 @@ (defn clear-handlers [bot event-type] (dosync (alter (:event-handlers bot) dissoc event-type))) - -; Loops ---------------------------------------------------------------------------- -(defn- run-loop [bot function sleep-ms loop-id] - (while (and (nil? (:exit @(:connection bot))) - (@(:loops bot) loop-id)) - (handle-action-group bot ((deref function) bot)) - (Thread/sleep sleep-ms)) - (dosync (alter (:loops bot) dissoc loop-id))) - - -(defn remove-loop [bot loop-id] - (dosync (alter (:loops bot) assoc loop-id nil))) - -(defn add-loop [bot function sleep-ms loop-id] - (dosync (alter (:loops bot) assoc loop-id :running)) - (.start (Thread. #(run-loop bot function sleep-ms loop-id))))