1
fanta 2015-03-05 12:05:34 +08:00
[code]
import os import thread import threading def run(*args, **kwargs): t = threading.current_thread() print "ppid:", os.getppid(), "pid:", os.getpid(), "tid:", thread.get_ident(), "ident:", t.ident, "tname:", t.getName() def main(): run() t = threading.Thread(target=run).start() if __name__ == "__main__": main() [/code] |
2
fanta 2015-03-05 12:06:20 +08:00
一个thread测试.
|
3
cougar 2015-03-05 12:35:57 +08:00
我是看楼主头像才进来的
|
4
inevermore 2015-03-05 12:45:41 +08:00
这不算坑,你对线程不熟悉吧。
Java还有C++自己封装的,都是这样 |
5
aheadlead OP @inevermore 好久没写程序了... 好多都不记得去了
|
6
dreamtrail 2015-03-05 14:14:34 +08:00
有multiprocessing就够了, 从不用thread
|
7
ZRS 2015-03-05 20:32:05 +08:00
233333333333
|