##// END OF EJS Templates
worker: POSIX only supports workers from main thread (issue6460)...
Joerg Sonnenberger -
r46857:a42502e9 default
parent child Browse files
Show More
@@ -67,6 +67,9 b' def _numworkers(ui):'
67
67
68 if pycompat.ispy3:
68 if pycompat.ispy3:
69
69
70 def ismainthread():
71 return threading.current_thread() == threading.main_thread()
72
70 class _blockingreader(object):
73 class _blockingreader(object):
71 def __init__(self, wrapped):
74 def __init__(self, wrapped):
72 self._wrapped = wrapped
75 self._wrapped = wrapped
@@ -100,6 +103,9 b' if pycompat.ispy3:'
100
103
101 else:
104 else:
102
105
106 def ismainthread():
107 return isinstance(threading.current_thread(), threading._MainThread)
108
103 def _blockingreader(wrapped):
109 def _blockingreader(wrapped):
104 return wrapped
110 return wrapped
105
111
@@ -155,6 +161,11 b' def worker('
155 release the GIL.
161 release the GIL.
156 """
162 """
157 enabled = ui.configbool(b'worker', b'enabled')
163 enabled = ui.configbool(b'worker', b'enabled')
164 if enabled and _platformworker is _posixworker and not ismainthread():
165 # The POSIX worker has to install a handler for SIGCHLD.
166 # Python up to 3.9 only allows this in the main thread.
167 enabled = False
168
158 if enabled and worthwhile(ui, costperarg, len(args), threadsafe=threadsafe):
169 if enabled and worthwhile(ui, costperarg, len(args), threadsafe=threadsafe):
159 return _platformworker(ui, func, staticargs, args, hasretval)
170 return _platformworker(ui, func, staticargs, args, hasretval)
160 return func(*staticargs + (args,))
171 return func(*staticargs + (args,))
General Comments 0
You need to be logged in to leave comments. Login now