Organize in submodules
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import multiprocessing
|
||||
|
||||
# We must import this explicitly, it is not imported by the top-level
|
||||
# multiprocessing module.
|
||||
import multiprocessing.pool
|
||||
|
||||
|
||||
class NoDaemonProcess(multiprocessing.Process):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(NoDaemonProcess, self).__init__(**kwargs)
|
||||
|
||||
# make 'daemon' attribute always return False
|
||||
def _get_daemon(self):
|
||||
return False
|
||||
|
||||
def _set_daemon(self, value):
|
||||
pass
|
||||
|
||||
daemon = property(_get_daemon, _set_daemon)
|
||||
|
||||
|
||||
# We sub-class multiprocessing.pool.Pool instead of multiprocessing.Pool
|
||||
# because the latter is only a wrapper function, not a proper class.
|
||||
class MyPool(multiprocessing.pool.Pool):
|
||||
Process = NoDaemonProcess
|
||||
Reference in New Issue
Block a user