AddRef increases the ref-count on the file ref.
()
| 72 | |
| 73 | // AddRef increases the ref-count on the file ref. |
| 74 | func (r *FileRef) AddRef() File { |
| 75 | if r == nil { |
| 76 | return nil |
| 77 | } |
| 78 | |
| 79 | r.m.Lock() |
| 80 | r.refs++ |
| 81 | file := r.file |
| 82 | r.m.Unlock() |
| 83 | |
| 84 | return file |
| 85 | } |
| 86 | |
| 87 | // DecRef decreases the ref-count on the file ref, and closing the |
| 88 | // underlying file when the ref-count reaches zero. |