service: service pool threads should respect _profile_hook.

This commit is contained in:
David Wilson 2018-07-26 18:39:38 -07:00
parent 3c55571fe2
commit 5d67ce7746
2 changed files with 7 additions and 2 deletions

View File

@ -86,6 +86,9 @@ Core Library
* Debug logs containing command lines are printed with the minimal quoting and
escaping required.
* When :func:`mitogen.core.enable_profiling` is active, :mod:`mitogen.service`
threads are run under the profiling hook just like other threads.
Thanks!
~~~~~~~

View File

@ -444,9 +444,11 @@ class Pool(object):
self.add(service)
self._threads = []
for x in range(size):
name = 'mitogen.service.Pool.%x.worker-%d' % (id(self), x,)
thread = threading.Thread(
name='mitogen.service.Pool.%x.worker-%d' % (id(self), x,),
target=self._worker_main,
name=name,
target=mitogen.core._profile_hook,
args=(name, self._worker_main),
)
thread.start()
self._threads.append(thread)