def store(proxys):
pidfile = open(proxyFilePath, "a")
for i in range(10):
try:
fcntl.flock(pidfile, fcntl.LOCK_EX | fcntl.LOCK_NB) # LOCK_EX ???:????????????????????????
# LOCK_NB ????: ?????????????????????????????????????
if type(proxys) == type([]):
for proxy in proxys:
pidfile.write(proxy + '\n')
else:
pidfile.write(proxys + '\n')
pidfile.close()
break
except:
# print "another instance is running..."
time.sleep(3)
评论列表
文章目录