Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for IncLockRef (0.16 sec)

  1. internal/lock/lock.go

    }
    
    // IsClosed - Check if the rlocked file is already closed.
    func (r *RLockedFile) IsClosed() bool {
    	r.mutex.Lock()
    	defer r.mutex.Unlock()
    	return r.refs == 0
    }
    
    // IncLockRef - is used by called to indicate lock refs.
    func (r *RLockedFile) IncLockRef() {
    	r.mutex.Lock()
    	r.refs++
    	r.mutex.Unlock()
    }
    
    // Close - this closer implements a special closer
    // closes the underlying fd only when the refs
    // reach zero.
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Sun Jan 02 17:15:06 GMT 2022
    - 2.5K bytes
    - Viewed (0)
  2. internal/lock/lock_test.go

    	if err != nil {
    		t.Fatal(err)
    	}
    	isClosed := rlk.IsClosed()
    	if isClosed {
    		t.Fatal("File ref count shouldn't be zero")
    	}
    
    	// Increase reference count to 2.
    	rlk.IncLockRef()
    
    	isClosed = rlk.IsClosed()
    	if isClosed {
    		t.Fatal("File ref count shouldn't be zero")
    	}
    
    	// Decrease reference count by 1.
    	if err = rlk.Close(); err != nil {
    		t.Fatal(err)
    	}
    
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Mon Sep 19 18:05:16 GMT 2022
    - 3.6K bytes
    - Viewed (0)
Back to top