summaryrefslogtreecommitdiff
path: root/src/buildstream/utils.py
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2020-09-14 12:05:12 +0200
committerJürg Billeter <j@bitron.ch>2020-09-14 17:39:17 +0200
commitfdca4c15e314dcf75d05e652798b43948598a012 (patch)
tree0e50bf62fc62b5584defe7420493c006132e5b7e /src/buildstream/utils.py
parent9c1dcc068b49a2cabfa925c5a5f75b390883da15 (diff)
downloadbuildstream-juerg/cache-query-wip.tar.gz
Diffstat (limited to 'src/buildstream/utils.py')
-rw-r--r--src/buildstream/utils.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/buildstream/utils.py b/src/buildstream/utils.py
index e9f06aad6..eb4881837 100644
--- a/src/buildstream/utils.py
+++ b/src/buildstream/utils.py
@@ -34,6 +34,7 @@ from stat import S_ISDIR
import subprocess
from subprocess import TimeoutExpired
import tempfile
+import threading
import time
import datetime
import itertools
@@ -874,6 +875,7 @@ def _pretty_size(size, dec_places=0):
# Return whether we are in the main process or not.
#
def _is_main_process():
+ return threading.current_thread() == threading.main_thread()
assert _MAIN_PID is not None
return os.getpid() == _MAIN_PID