# File lib/fsdb/file-lock.rb, line 30
  def lock_shared
    if Thread.list.size == 1
      begin
        flock(LOCK_SH) ## need to use fcntl for Linux NFS
      rescue Errno::EINTR
        retry
      end
    else
      # ugly hack because waiting for a lock in a Ruby thread blocks the process
      period = 0.001
      until flock(LOCK_SH|LOCK_NB) ## need to use fcntl for Linux NFS
        sleep period
        period *= 2 if period < 1
      end
    end
  end