summaryrefslogtreecommitdiff
path: root/lib/monitor.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/monitor.rb')
-rw-r--r--lib/monitor.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/monitor.rb b/lib/monitor.rb
index 288ed755eab..86c779f1844 100644
--- a/lib/monitor.rb
+++ b/lib/monitor.rb
@@ -251,9 +251,12 @@ module MonitorMixin
# Initializes the MonitorMixin after being included in a class or when an
# object has been extended with the MonitorMixin
def mon_initialize
+ if defined?(@mon_mutex)
+ raise ThreadError, "already initialized"
+ end
+ @mon_mutex = Thread::Mutex.new
@mon_owner = nil
@mon_count = 0
- @mon_mutex = Thread::Mutex.new
end
def mon_check_owner