7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2024-11-22 02:15:01 +00:00
kicad/thirdparty/pybind11/tests/test_thread.py
Jeff Young 2533141583 Revert "Update pybind11 to version 2.10.4" for now.
This reverts commits 9d077c9ba5 and
b4938f5198.

They cause a crash-on-startup on Mac ARM machines, failing to get the
locale encoding (nl_langinfo(CODESET) failed).
2023-04-18 17:28:10 +01:00

45 lines
875 B
Python

# -*- coding: utf-8 -*-
import threading
from pybind11_tests import thread as m
class Thread(threading.Thread):
def __init__(self, fn):
super(Thread, self).__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(Thread, self).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()