Commit e8815a8f authored by Jérome Perrin's avatar Jérome Perrin

Thread.is_alive

parent 46515653
...@@ -248,7 +248,7 @@ class TestSelectionPersistence(unittest.TestCase): ...@@ -248,7 +248,7 @@ class TestSelectionPersistence(unittest.TestCase):
t = Thread(target=thread_func, args=(self.db.open,)) t = Thread(target=thread_func, args=(self.db.open,))
t.start() t.start()
t.join(60) t.join(60)
self.assertFalse(t.isAlive()) self.assertFalse(t.is_alive())
def testSelectionParamConflictResolution(self): def testSelectionParamConflictResolution(self):
# same user edits the same selection with two different parameters # same user edits the same selection with two different parameters
......
...@@ -55,7 +55,7 @@ def main(): ...@@ -55,7 +55,7 @@ def main():
print("thread: %i request: %i url: %s" % (i,request_number,url)) print("thread: %i request: %i url: %s" % (i,request_number,url))
else: else:
for t in range(0,max_thread): for t in range(0,max_thread):
if threads[t].isAlive() == 0: if threads[t].is_alive() == 0:
url = '//user%i:user%i@localhost:9673%s?__ac_name=user%s&__ac_password=user%s' % \ url = '//user%i:user%i@localhost:9673%s?__ac_name=user%s&__ac_password=user%s' % \
(t,t,list_url[i][:-1],t,t) (t,t,list_url[i][:-1],t,t)
threads[t] = Thread(target=checker[t].CheckUrl,kwargs={'url':url}) threads[t] = Thread(target=checker[t].CheckUrl,kwargs={'url':url})
...@@ -142,7 +142,7 @@ class Checker(URLOpener): ...@@ -142,7 +142,7 @@ class Checker(URLOpener):
try: try:
thread = Thread(target=self.SearchUrl,args=(url,)) thread = Thread(target=self.SearchUrl,args=(url,))
thread.start() thread.start()
while thread.isAlive(): while thread.is_alive():
sleep(0.5) sleep(0.5)
print("Connection to %s went fine" % url) print("Connection to %s went fine" % url)
except IOError as err: except IOError as err:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment