【发布时间】:2014-09-22 05:16:32
【问题描述】:
我想使用线程来做一些阻塞工作。我该怎么做:
- 安全地生成线程
- 做有用的工作
- 等到线程结束
- 继续函数
这是我的代码:
import threading
def my_thread(self):
# Wait for the server to respond..
def main():
a = threading.thread(target=my_thread)
a.start()
# Do other stuff here
【问题讨论】:
标签: python multithreading thread-safety