]> git.cworth.org Git - sup/commitdiff
disallow concurrent polls
authorwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Mon, 20 Aug 2007 01:14:42 +0000 (01:14 +0000)
committerwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Mon, 20 Aug 2007 01:14:42 +0000 (01:14 +0000)
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@531 5c8cc53c-5e98-4d25-b20a-d8db53a31250

lib/sup/poll.rb

index 45e62103355c3cdaf532e0f91b0e2362966d4f00..f8c6845326ed5c5df5b4d18afe782a7dd80f5b41 100644 (file)
@@ -27,6 +27,7 @@ EOS
     @mutex = Mutex.new
     @thread = nil
     @last_poll = nil
+    @polling = false
     
     self.class.i_am_the_instance self
   end
@@ -36,6 +37,8 @@ EOS
   end
 
   def poll
+    return if @polling
+    @polling = true
     HookManager.run "before-poll"
 
     BufferManager.flash "Polling for new messages..."
@@ -48,6 +51,7 @@ EOS
 
     HookManager.run "after-poll", :num => num, :num_inbox => numi, :from_and_subj => from_and_subj, :from_and_subj_inbox => from_and_subj_inbox
 
+    @polling = false
     [num, numi]
   end