mirror of
https://github.com/shmilylty/OneForAll.git
synced 2026-08-26 04:47:48 +08:00
设置线程为守护线程 随主线程结束而结束
This commit is contained in:
+3
-2
@@ -167,12 +167,13 @@ def bulk_request(urls):
|
|||||||
thread_count = req_thread_count()
|
thread_count = req_thread_count()
|
||||||
|
|
||||||
progress_thread = Thread(target=progress, name='ProgressThread',
|
progress_thread = Thread(target=progress, name='ProgressThread',
|
||||||
args=(urls, resp_queue))
|
args=(urls, resp_queue), daemon=True)
|
||||||
progress_thread.start()
|
progress_thread.start()
|
||||||
|
|
||||||
for i in range(thread_count):
|
for i in range(thread_count):
|
||||||
request_thread = Thread(target=request, name=f'RequestThread-{i}',
|
request_thread = Thread(target=request, name=f'RequestThread-{i}',
|
||||||
args=(urls_queue, resp_queue, session))
|
args=(urls_queue, resp_queue, session),
|
||||||
|
daemon=True)
|
||||||
request_thread.start()
|
request_thread.start()
|
||||||
|
|
||||||
urls_queue.join()
|
urls_queue.join()
|
||||||
|
|||||||
+2
-3
@@ -49,9 +49,8 @@ class Collect(object):
|
|||||||
# Create subdomain collection threads
|
# Create subdomain collection threads
|
||||||
for collect_func in self.collect_funcs:
|
for collect_func in self.collect_funcs:
|
||||||
func_obj, func_name = collect_func
|
func_obj, func_name = collect_func
|
||||||
thread = threading.Thread(target=func_obj,
|
thread = threading.Thread(target=func_obj, name=func_name,
|
||||||
name=func_name,
|
args=(self.domain,), daemon=True)
|
||||||
args=(self.domain,))
|
|
||||||
threads.append(thread)
|
threads.append(thread)
|
||||||
# Start all threads
|
# Start all threads
|
||||||
for thread in threads:
|
for thread in threads:
|
||||||
|
|||||||
Reference in New Issue
Block a user