Actions
Bug #13598
closedmutex_m: Missing info in the doc
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
Description
The doc for Mutex_m should remind the user of the necessity of calling super() in each class that includes Mutex_m.
The average user will do:
require 'mutex_m'
class A
include Mutex_m
def initialize myval
@myval = myval
# error: no super()
end
def method
@myval
end
end
a = A.new 'abc'
a.mu_synchronize{a.method}
He will get:
NoMethodError: undefined method `synchronize' for nil:NilClass
from /usr/lib64/ruby/2.4.0/mutex_m.rb:74:in `mu_synchronize'
and will lose the rest of the evening trying to understand what went wrong ;-)
Files
Updated by hsbt (Hiroshi SHIBATA) over 6 years ago
- Status changed from Open to Assigned
- Assignee set to 13939
Updated by aycabta (aycabta .) over 6 years ago
- Status changed from Assigned to Closed
Applied in changeset trunk|r65270.
Add missing info for Mutex_m to the doc [Bug #13598]
- lib/mutex_m.rb: The #initialize method in a class that includes
Mutex_m needs calling #super.
Actions
Like0
Like0Like0