diff options
author | Koichi Sasada <[email protected]> | 2019-12-04 13:36:41 +0900 |
---|---|---|
committer | Koichi Sasada <[email protected]> | 2019-12-04 13:36:41 +0900 |
commit | c6e3db0c66312af1e932c21006437419efa9ac75 () | |
tree | b016c716a577fdd024a397a87e2eb715fb40586e /ext/monitor/lib | |
parent | f9e5c74cd24025a5aa19e318e8fecabf207f1b7b (diff) |
new_cond before mon_initialize
MonitorMixin#new_cond can be called before mon_initialize, so we need to initialize `@monitor` before it. https://bugs.ruby-lang.org/issues/16255#note-4
-rw-r--r-- | ext/monitor/lib/monitor.rb | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -208,6 +208,10 @@ module MonitorMixin # Monitor object. # def new_cond return ConditionVariable.new(@mon_data) end @@ -224,8 +228,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_data) && @mon_data_owner_object_id == self.object_id - raise ThreadError, "already initialized" end @mon_data = ::Monitor.new @mon_data_owner_object_id = self.object_id |