Class: Selenium::WebDriver::SocketLock
- Inherits:
-
Object
- Object
- Selenium::WebDriver::SocketLock
- Defined in:
- lib/selenium/webdriver/common/socket_lock.rb
Instance Method Summary collapse
-
#initialize(port, timeout) ⇒ SocketLock
constructor
A new instance of SocketLock.
-
#locked(&blk) ⇒ Object
Attempt to acquire a lock on the given port.
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 |