    /*
     *  call-seq:
     *     lock.obtain(timeout = 1) -> bool
     *
     *  Obtain a lock. Returns true if lock was successfully obtained. Make sure
     *  the lock is released using Lock#release. Otherwise you'll be left with a
     *  stale lock file.
     *
     *  The timeout defaults to 1 second and 5 attempts are made to obtain the
     *  lock. If you're doing large batch updates on the index with multiple
     *  processes you may need to increase the lock timeout but 1 second will be
     *  substantial in most cases.
     *
     *  timeout:: seconds to wait to obtain lock before timing out and returning
     *            false
     *  return::  true if lock was successfully obtained. Raises a
     *            Lock::LockError otherwise.
     */
    static VALUE
    frb_lock_obtain(int argc, VALUE *argv, VALUE self)
    {
        VALUE rtimeout;
        int timeout = 1;
        Lock *lock;
        GET_LOCK(lock, self);

        if (rb_scan_args(argc, argv, "01", &rtimeout) > 0) {
            timeout = FIX2INT(rtimeout);
        }
        /* TODO: use the lock timeout */
        if (!lock->obtain(lock)) {
            rb_raise(cLockError, "could not obtain lock: #%s", lock->name);
        }
        return Qtrue;
    }