Re: [問題] socketio & thread

作者: gn00618777 (非常念舊)   2015-05-17 11:54:59
※ 引述《gn00618777 (非常念舊)》之銘言:
: 我在 flask 框架下使用 sokcetio,以下是草略架構
: server.py:
: from flask import Flask
: from threadin import Thread
: app = Flask(__name__)
: socketio = SocketIO(app)
: def background_thread():
: while True:
: ...
: ...
: @app.route('/')
: def index():
: thread = Thread(target=background_thread)
: tread.start()
: return render_template('receiver.html')
: @socketio.on('connect',namespace='/test')
作者: gn00618777 (非常念舊)   2015-05-17 12:08:00
OK,測試結果還是有增加,所以 thread 還是沒有結束沒錯,只是有沒有辦法直接 kill thread 的方法
作者: dritchie (卍~邁斯納效應~卍)   2015-05-17 21:57:00
Python 原生不提供 terminate thread 的方法
作者: eight0 (欸XD)   2015-05-18 12:30:00
http://x.co/9SsXc 可以 stop/pause/resume,參考看看
作者: gn00618777 (非常念舊)   2015-05-18 16:16:00
感謝

Links booklink

Contact Us: admin [ a t ] ucptt.com