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