Class: Selenium::WebDriver::SocketLock

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/webdriver/common/socket_lock.rb

Instance Method Summary collapse

Constructor Details

#initialize(port, timeout) ⇒ SocketLock

Returns a new instance of SocketLock.



24
25
26
27
# File 'lib/selenium/webdriver/common/socket_lock.rb', line 24

def initialize(port, timeout)
  @port    = port
  @timeout = timeout
end

Instance Method Details

#locked(&blk) ⇒ Object

Attempt to acquire a lock on the given port. Control is yielded to an execution block if the lock could be successfully obtained.



34
35
36
37
38
39
40
41
42
# File 'lib/selenium/webdriver/common/socket_lock.rb', line 34

def locked(&blk)
  lock

  begin
    yield
  ensure
    release
  end
end