Skip to content

Commit

Permalink
Add developer-friendly error when monitor not initialized
Browse files Browse the repository at this point in the history
As I'm fixing monitor initialization issues, it seems to me that the
current approach is a bit whack-a-mole so let's at least prepare a nice
error message for users to get in case we're still missing a few corner
cases.
  • Loading branch information
ivoanjo committed Jun 24, 2018
1 parent e8ee0d2 commit 04db895
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/concurrent/thread_safe/util/array_hash_rbx.rb
Expand Up @@ -41,7 +41,14 @@ def #{method}(*args)
else
klass.class_eval <<-RUBY, __FILE__, __LINE__ + 1
def #{method}(*args)
@_monitor.synchronize { super }
monitor = @_monitor
unless monitor
raise("BUG: Internal monitor was not properly initialized. Please report this to the "\
"concurrent-ruby developers.")
end
monitor.synchronize { super }
end
RUBY
end
Expand Down

0 comments on commit 04db895

Please sign in to comment.