Sha256: f573b501601ed910ceb8717f3a16440cc8df04cbda3254ef5e479ac311580e10

Contents?: true

Size: 732 Bytes

Versions: 4

Compression:

Stored size: 732 Bytes

Contents

# Copyright: Copyright (c) 2004  Nicolas Despres. All rights reserved.
# Author: Nicolas Despres  <polrop@lrde.epita.fr>.
# License: Gnu General Public License.

# $LastChangedBy: polrop $
# $Id: object_monitor_activity.rb 105 2005-01-16 17:42:26Z polrop $


require 'observable'


class ObjectMonitorActivity
  include Observable

  def initialize
    @mutex = Mutex.new
    @activity = {}
  end

  def update(msg, info)
    case msg
    when :start_method: @mutex.synchronize { @activity[info[:num]] = info }
    when :stop_method: @mutex.synchronize { @activity.delete(info[:num]) }
    else raise 'unknown message'
    end
  end

  def snapshot
    @mutex.synchronize { @activity.dup }
  end

end # class ObjectMonitorActivity

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
ttk-0.1.576 ruby_ex/object_monitor_activity.rb
ttk-0.1.580 ruby_ex/object_monitor_activity.rb
ttk-0.1.579 ruby_ex/object_monitor_activity.rb
vcs-0.2.148 ruby_ex/object_monitor_activity.rb