summaryrefslogtreecommitdiff
path: root/src/buildstream/utils.py
diff options
context:
space:
mode:
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