Project

General

Profile

Actions

Bug #13598

closed

mutex_m: Missing info in the doc

Added by mala (stefano frabetti) almost 7 years ago. Updated over 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
[ruby-core:81376]

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

mutex_m.doc.patch (460 Bytes) mutex_m.doc.patch patch to improve the mutex_m doc mala (stefano frabetti), 05/25/2017 08:57 AM

Updated by hsbt (Hiroshi SHIBATA) over 5 years ago

  • Status changed from Open to Assigned
  • Assignee set to 13939
Actions #2

Updated by aycabta (aycabta .) over 5 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

Also available in: Atom PDF

Like0
Like0Like0