我试图理解线程是如何工作的。在
下面是我无限运行的代码:
while(True):
# Check All Streams if they are online AND with which Summoner #
checkStreams()
# Check if we have new finished games #
if newGames:
getMatchHistory()
updateSummonerStats()
# Update Online Stats #
updateOnline()
checkStreams()
是一个相当小的函数,但是getMatchHistory()
和{
从我在这里读到的http://softwareramblings.com/2008/06/running-functions-as-threads-in-python.html我的方法是:
这些函数应该是独立的线程运行,但是后面的函数应该立即继续
^{pr2}$现在我遇到了这样的问题:两个线程函数都访问MySQL数据库,这会导致以下错误:Packet sequence number wrong - got 0 expected 2
和许多类似的错误。在
对于平行函数,这是正确的方法还是有更好的解决方案?在
目前没有回答
相关问题 更多 >
编程相关推荐