summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-03-20 00:27:55 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-03-20 00:27:55 +0000
commit1c9e8480384b016e710be6881bba3519e6a225f4 (patch)
tree7d0af86a6dfe547f3887e037ab80f61f58fa0f8c /data
parent0cb6065efddab6726fe778303802850ba5de08ee (diff)
rss plugin: lock the mutex on more occasions
Diffstat (limited to 'data')
-rw-r--r--data/rbot/plugins/rss.rb24
1 files changed, 14 insertions, 10 deletions
diff --git a/data/rbot/plugins/rss.rb b/data/rbot/plugins/rss.rb
index caebc3fc..69189417 100644
--- a/data/rbot/plugins/rss.rb
+++ b/data/rbot/plugins/rss.rb
@@ -53,11 +53,13 @@ class ::RssBlob
end
def dup
- self.class.new(@url,
- @handle,
- @type ? @type.dup : nil,
- @watchers.dup,
- @xml ? @xml.dup : nil)
+ @mutex.synchronize do
+ self.class.new(@url,
+ @handle,
+ @type ? @type.dup : nil,
+ @watchers.dup,
+ @xml ? @xml.dup : nil)
+ end
end
# Downcase all watchers, possibly turning them into Strings if they weren't
@@ -81,12 +83,16 @@ class ::RssBlob
if watched_by?(who)
return nil
end
- @watchers << who.downcase
+ @mutex.synchronize do
+ @watchers << who.downcase
+ end
return who
end
def rm_watch(who)
- @watchers.delete(who.downcase)
+ @mutex.synchronize do
+ @watchers.delete(who.downcase)
+ end
end
def to_a
@@ -151,9 +157,7 @@ class RSSFeedsPlugin < Plugin
def save
unparsed = Hash.new()
@feeds.each { |k, f|
- f.mutex.synchronize do
- unparsed[k] = f.dup
- end
+ unparsed[k] = f.dup
}
@registry[:feeds] = unparsed
end