diff options
author | Patrick J Cherry <patrick@bytemark.co.uk> | 2011-06-13 11:02:37 +0100 |
---|---|---|
committer | Patrick J Cherry <patrick@bytemark.co.uk> | 2011-06-13 11:02:37 +0100 |
commit | b22cbc87927553f6dbb5754281e95fe9bad2eed1 (patch) | |
tree | 5575791fe84492648a8cc92433c267815056507a /lib/mauve/mauve_thread.rb | |
parent | 495c44445642cfae8f23fadde299ad5307f5be58 (diff) |
* Tidied up mauveserver to handle HUP restarts
* Added HTML santizing to the alert class, so bad HTML is stripped as part of
processing.
* Alert#cleared? now means "not raised"
* Better error handling in the Timer class, making sure that the timer never
gets permanently frozen.
* Moved notification and packet buffers to the Server class, meaning that if
the Processor or Notifier threads crash, we don't lose all the items waiting
to be processed/notified.
* XMPP/Email Alerts now use templates, instead of instance methods.
* Emails now get sent as multipart with HTML to allow detail fields to be
shown as nature intended.
Diffstat (limited to 'lib/mauve/mauve_thread.rb')
-rw-r--r-- | lib/mauve/mauve_thread.rb | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/mauve/mauve_thread.rb b/lib/mauve/mauve_thread.rb index f40c79c..bd036db 100644 --- a/lib/mauve/mauve_thread.rb +++ b/lib/mauve/mauve_thread.rb @@ -57,16 +57,19 @@ module Mauve logger.debug("Thread has not frozen!") unless @thread.stop? end + def frozen? + @frozen and @thread.stop? + end + def thaw logger.debug("Thawing") - @frozen = false - @thread.wakeup if @thread.stop? end def start logger.debug("Starting") + @stop = false @thread = Thread.new{ self.run_thread { self.main_loop } } end @@ -83,12 +86,7 @@ module Mauve end def join(ok_exceptions=[]) - begin - @thread.join if @thread.is_a?(Thread) - rescue StandardError => err - logger.debug "#{err.to_s} #{err.class}" - Kernel.raise err unless ok_exceptions.any?{|e| err.is_a?(e)} - end + @thread.join if @thread.is_a?(Thread) end def raise(ex) @@ -127,6 +125,10 @@ module Mauve logger.debug("Killed") end + def thread + @thread + end + end end |