python threading开启的线程中用multiprocessing再开启多线程出现AttributeError

一个简单的例子重现这个报错:
frommultiprocessing.dummyimportPoolasThreadPool
importthreading
defwork():
l=[1,2,3]
pool=ThreadPool(3)
pool.map(work2,l)
pool.close()
pool.join()
if__name__=='__main__':
t=threading.Thread(target=work)
t.start()
错误信息:
ExceptioninthreadThread-1:
Traceback(mostrecentcalllast):
File"/usr/lib/python2.7/threading.py",line551,in__bootstrap_inner
self.run()
File"/usr/lib/python2.7/threading.py",line504,inrun
self.__target(*self.__args,**self.__kwargs)
File"/home/eggeek/palendar/geodata/operation/praser.py",line7,inwork
pool=ThreadPool(3)
File"/usr/lib/python2.7/multiprocessing/dummy/__init__.py",line150,inPool
returnThreadPool(processes,initializer,initargs)
File"/usr/lib/python2.7/multiprocessing/pool.py",line685,in__init__
Pool.__init__(self,processes,initializer,initargs)
File"/usr/lib/python2.7/multiprocessing/pool.py",line136,in__init__
self._repopulate_pool()
File"/usr/lib/python2.7/multiprocessing/pool.py",line199,in_repopulate_pool
w.start()
File"/usr/lib/python2.7/multiprocessing/dummy/__init__.py",line73,instart
self._parent._children[self]=None
AttributeError:'Thread'objecthasnoattribute'_children'
HUX布斯
浏览 330回答 2
2回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript