From df3000b05fd1b8f65289b3b0fbf476a19ef61869 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Billeter?= Date: Mon, 2 Sep 2019 12:12:50 +0200 Subject: cascache.py: Add has_open_grpc_channels() method --- src/buildstream/_cas/cascache.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/buildstream/_cas/cascache.py b/src/buildstream/_cas/cascache.py index af69e3d68..831229fe8 100644 --- a/src/buildstream/_cas/cascache.py +++ b/src/buildstream/_cas/cascache.py @@ -136,6 +136,14 @@ class CASCache(): if not (os.path.isdir(headdir) and os.path.isdir(objdir)): raise CASCacheError("CAS repository check failed for '{}'".format(self.casdir)) + # has_open_grpc_channels(): + # + # Return whether there are gRPC channel instances. This is used to safeguard + # against fork() with open gRPC channels. + # + def has_open_grpc_channels(self): + return bool(self._casd_channel) + # notify_fork_disabled(): # # Called by Context when fork() is disabled. This will enable communication -- cgit v1.2.1