mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 21:07:13 +02:00
Hardcopy of pybind11 instead of using git submodules (#552)
* removed pybind as submodule * added hardcopy of pybind11 2.10.0 * rename pybind11 folder to avoid conflicts when changing branch Co-authored-by: Dhanya Thattil <dhanya.thattil@psi.ch>
This commit is contained in:
42
libs/pybind/tests/test_thread.py
Normal file
42
libs/pybind/tests/test_thread.py
Normal file
@ -0,0 +1,42 @@
|
||||
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()
|
Reference in New Issue
Block a user