ThreadPoolExecutorを使用して非同期処理を生成した際に
Futureオブジェクトを取得しておいて、後々任意のタイミングで中断したいのですが、
ドキュメントから cancel() で呼び出しのキャンセルを試みるとあるのですが、
キャンセルが出来ません。
こちら強制的にキャンセルすることは可能でしょうか。
※参考ドキュメント
https://docs.python.jp/3/library/concurrent.futures.html
Python
1def func(): 2 print('Start') 3 time.sleep(10) 4 print('End') 5 6if __name__ == '__main__': 7 threadPoolExecutor = ThreadPoolExecutor() 8 future = threadPoolExecutor.submit(func) 9 future.cancel() #即キャンセルではなく、他の任意タイミング
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/04/28 15:57