これは私のコードで、さまざまな出力が得られます。
import threading
import time
def th_fun(limit,sleeptime):
print '%s' % (limit)
print '%s number of threads are active' % (threading.activeCount())
time.sleep(sleeptime)
if __name__ == '__main__':
for i in range(5):
t = threading.Thread(target = th_fun , args = (i,1))
t.start()
スレッドがいつ非アクティブになるかを誰かが知ることができますか? 私の理解では、5 つの異なるスレッド オブジェクトが作成されて実行され、 time.sleeptime() が実行されるとすぐに非アクティブになります。