/
UCS
/
pybind11
Обзор
Документация
Войти
/
UCS
/
pybind11
Код
Запросы
0
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
tests/test_thread.py
42 строки
826 B
Ralf W. Grosse-Kunstleve
Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688)
11 фев 2022, 05:28
Не верифицирован
11 фев 2022, 05:28
6493f49
Код
Авторство
О чём код?
import threading from pybind11_tests import thread as m class Thread(threading.Thread): def __init__(self, fn): super().__init__() self.fn = fn self.e = None def run(self): try: for i in range(10): self.fn(i, i) except Exception as e: self.e = e def join(self): super().join() if self.e: raise self.e def test_implicit_conversion(): a = Thread(m.test) b = Thread(m.test) c = Thread(m.test) for x in [a, b, c]: x.start() for x in [c, b, a]: x.join() def test_implicit_conversion_no_gil(): a = Thread(m.test_no_gil) b = Thread(m.test_no_gil) c = Thread(m.test_no_gil) for x in [a, b, c]: x.start() for x in [c, b, a]: x.join()