python
from tomorrow import threads
@threads(5)
def do_task(task_id):
print(f"Task {task_id} is completed.")
for i in range(10):
do_task(i)
python
from concurrent.futures import ThreadPoolExecutor
def do_task(task_id):
print(f"Task {task_id} is completed.")
with ThreadPoolExecutor(max_workers=5) as executor:
for i in range(10):
executor.submit(do_task, i)