# File lib/fsdb/file-lock.rb, line 10
  def lock_exclusive
    if Thread.list.size == 1
      begin
        flock(LOCK_EX) ## 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_EX|LOCK_NB) ## need to use fcntl for Linux NFS
        sleep period
        period *= 2 if period < 1
      end
    end
  end