1.首先是一个问题,有知道的请求讨论
2.关于join的问题(join:不间断join中的线程)
join
(
timeout=None
)
Wait until the thread terminates. This blocks the calling thread until the thread whose join()
method is called terminates – either normally or through an unhandled exception – or until the optional timeout occurs.
thread1 = threading.Thread(target = job, name = 'T1') ###此处的()不可以有(查了一段时间的问题)
thread1.start()
####thread1.join()
print('main end')
3.被多线程回调的函数不能有返回值。此时可以通过queue来进行
class
multiprocessing.
Queue
(
[
maxsize
]
)
Returns a process shared queue implemented using a pipe and a few locks/semaphores. When a process first puts an item on the queue a feeder thread is started which transfers objects from a buffer into the pipe.
应该用的是这个(多线程专用的)
4.关于lock的东西
不可以在子函数中定义全局变量,即使是main函数都不行
有时候会出问题。例如,行对其的问题
其余参考网上找的一篇,写的还不哦