/
ilya.petrash
/
SimplePyScripts
Обзор
Документация
Войти
/
ilya.petrash
/
SimplePyScripts
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
0.0.0
multithreading__example/mini_example.py
28 строк
576 B
ipetrash
#
27 ноя 2017, 14:48
27 ноя 2017, 14:48
db2d3ef
Код
Авторство
О чём код?
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' import threading def run(name='main', sleep_seconds=None): if sleep_seconds: import time time.sleep(sleep_seconds) print('start: "{}": {}'.format(name, threading.current_thread())) if __name__ == '__main__': run() thread = threading.Thread(target=run, args=('thread #1', 3)) thread.start() thread = threading.Thread(target=run, args=('thread #2', 1)) thread.start() thread = threading.Thread(target=run, args=('thread #3', 0)) thread.start()