Class: Selenium::WebDriver::SocketLock Private
    Do not use.  This class is for internal use only.
  
| Relationships & Source Files | |
| Inherits: | Object | 
| Defined in: | rb/lib/selenium/webdriver/common/socket_lock.rb | 
Class Method Summary
- .new(port, timeout) ⇒ SocketLock constructor Internal use only
Instance Attribute Summary
- #can_lock? ⇒ Boolean readonly private Internal use only
- #did_lock? ⇒ Boolean readonly private Internal use only
Instance Method Summary
- 
    
      #locked  
    
    Internal use only
    Attempt to acquire a lock on the given port. 
- #current_time private Internal use only
- #lock private Internal use only
- #release private Internal use only
Constructor Details
    .new(port, timeout)  ⇒ SocketLock 
  
# File 'rb/lib/selenium/webdriver/common/socket_lock.rb', line 27
def initialize(port, timeout) @port = port @server = nil @timeout = timeout end
Instance Attribute Details
    #can_lock?  ⇒ Boolean  (readonly, private)
  
    #did_lock?  ⇒ Boolean  (readonly, private)
  
# File 'rb/lib/selenium/webdriver/common/socket_lock.rb', line 77
def did_lock? !@server.nil? end
Instance Method Details
#current_time (private)
[ GitHub ]# File 'rb/lib/selenium/webdriver/common/socket_lock.rb', line 60
def current_time Process.clock_gettime(Process::CLOCK_MONOTONIC) end
#lock (private)
# File 'rb/lib/selenium/webdriver/common/socket_lock.rb', line 50
def lock max_time = current_time + @timeout sleep 0.1 until can_lock? || current_time >= max_time return if did_lock? raise Error::WebDriverError, "unable to bind to locking port #{@port} within #{@timeout} seconds" end
#locked
Attempt to acquire a lock on the given port. Control is yielded to an execution block if the lock could be successfully obtained.
#release (private)
[ GitHub ]# File 'rb/lib/selenium/webdriver/common/socket_lock.rb', line 64
def release @server&.close end