From f30371ca43fa423641c7c261b142243f7e1ca920 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Tue, 2 Apr 2024 12:44:01 +0200 Subject: add documentation regarding resource management of AtLocations --- linuxnamespaces/atlocation.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'linuxnamespaces') diff --git a/linuxnamespaces/atlocation.py b/linuxnamespaces/atlocation.py index 0257014..9e32596 100644 --- a/linuxnamespaces/atlocation.py +++ b/linuxnamespaces/atlocation.py @@ -41,6 +41,13 @@ class AtLocation: filesystem object. Otherwise, the location specifies the filesystem object. If it is relative, it the anchor is the file descriptor or the current working directory if the file descriptor is AT_FDCWD. + + There are two ways of managing the closing of file descriptors. One is to + treat AtLocation as an object that borrows file descriptors but never + closes them and taking care of closing them in some other way. The other is + using AtLocation as a context manager and thinking of it as owning a file + descriptor. Some methods such as walk dictate a particular lifetime + management. """ fd: int -- cgit v1.2.3