Skip to content

Commit

Permalink
Make sure a Monitor is not initialized twice
Browse files Browse the repository at this point in the history
* Otherwise it makes it possible to have two threads enter the same Monitor concurrently,
  as they can acquire two different Mutex instances.
  • Loading branch information
eregon committed May 5, 2017
1 parent 7f73240 commit 1adf384
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/mri/monitor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ def initialize(*args)
# Initializes the MonitorMixin after being included in a class or when an
# object has been extended with the MonitorMixin
def mon_initialize
raise "already initialized" if @mon_mutex
@mon_owner = nil
@mon_count = 0
@mon_mutex = Mutex.new
Expand Down

0 comments on commit 1adf384

Please sign in to comment.