/
oleglpts
/
PriorityThreadPoolExecutor
Обзор
Документация
Войти
/
oleglpts
/
PriorityThreadPoolExecutor
Код
Запросы
0
Задачи
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
examples/example.py
25 строк
1 KB
oleg
Initial commit
08 мар 2019, 11:13
08 мар 2019, 11:13
7d3722e
Код
Авторство
О чём код?
#!/usr/bin/env python3 import time from PriorityThreadPoolExecutor import PriorityThreadPoolExecutor ######################################################################################################################## # Test function for threads # ######################################################################################################################## def print_number(number, seconds=3): print('Start %s' % number) time.sleep(seconds) print('Stop %s' % number) ######################################################################################################################## # Entry point # ######################################################################################################################## if __name__ == '__main__': pool = PriorityThreadPoolExecutor(max_workers=1) with pool: for x in range(10): pool.submit(print_number, x-1, 1, priority=9-x)