summaryrefslogtreecommitdiff
path: root/internal/openfiletable/open_file_table.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/openfiletable/open_file_table.go')
-rw-r--r--internal/openfiletable/open_file_table.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/openfiletable/open_file_table.go b/internal/openfiletable/open_file_table.go
index e21c96d..4a8ce28 100644
--- a/internal/openfiletable/open_file_table.go
+++ b/internal/openfiletable/open_file_table.go
@@ -112,3 +112,11 @@ func (c *countingMutex) Lock() {
func WriteOpCount() uint64 {
return atomic.LoadUint64(&t.writeOpCount)
}
+
+// CountOpenFiles returns how many entries are currently in the table
+// in a threadsafe manner.
+func CountOpenFiles() int {
+ t.Lock()
+ defer t.Unlock()
+ return len(t.entries)
+}