Show More
@@ -67,6 +67,9 b' def _numworkers(ui):' | |||
|
67 | 67 | |
|
68 | 68 | if pycompat.ispy3: |
|
69 | 69 | |
|
70 | def ismainthread(): | |
|
71 | return threading.current_thread() == threading.main_thread() | |
|
72 | ||
|
70 | 73 | class _blockingreader(object): |
|
71 | 74 | def __init__(self, wrapped): |
|
72 | 75 | self._wrapped = wrapped |
@@ -100,6 +103,9 b' if pycompat.ispy3:' | |||
|
100 | 103 | |
|
101 | 104 | else: |
|
102 | 105 | |
|
106 | def ismainthread(): | |
|
107 | return isinstance(threading.current_thread(), threading._MainThread) | |
|
108 | ||
|
103 | 109 | def _blockingreader(wrapped): |
|
104 | 110 | return wrapped |
|
105 | 111 | |
@@ -155,6 +161,11 b' def worker(' | |||
|
155 | 161 | release the GIL. |
|
156 | 162 | """ |
|
157 | 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 | 169 | if enabled and worthwhile(ui, costperarg, len(args), threadsafe=threadsafe): |
|
159 | 170 | return _platformworker(ui, func, staticargs, args, hasretval) |
|
160 | 171 | return func(*staticargs + (args,)) |
General Comments 0
You need to be logged in to leave comments.
Login now