Class: MiniRacer::Isolate

Inherits:
Object
  • Object
show all
Defined in:
lib/mini_racer.rb

Instance Method Summary collapse

Constructor Details

#initialize(snapshot = nil) ⇒ Isolate

Returns a new instance of Isolate.



52
53
54
55
56
57
58
59
60
61
# File 'lib/mini_racer.rb', line 52

def initialize(snapshot = nil)
  unless snapshot.nil? || snapshot.is_a?(Snapshot)
    raise ArgumentError, "snapshot must be a Snapshot object, passed a #{snapshot.inspect}"
  end

  @lock = Mutex.new

  # defined in the C class
  init_with_snapshot(snapshot)
end

Instance Method Details

#with_lockObject



63
64
65
# File 'lib/mini_racer.rb', line 63

def with_lock
  @lock.synchronize { yield }
end