μHAL (v2.8.19)
Part of the IPbus software repository
Loading...
Searching...
No Matches
python
pybind11
tests
test_thread.py
Go to the documentation of this file.
1
import
threading
2
3
from
pybind11_tests
import
thread
as
m
4
5
6
class
Thread(threading.Thread):
7
def
__init__
(self, fn):
8
super().
__init__
()
9
self.
fn
= fn
10
self.
e
=
None
11
12
def
run
(self):
13
try
:
14
for
i
in
range(10):
15
self.
fn
(i, i)
16
except
Exception
as
e:
17
self.
e
= e
18
19
def
join(self):
20
super().join()
21
if
self.
e
:
22
raise
self.
e
23
24
25
def
test_implicit_conversion
():
26
a =
Thread
(m.test)
27
b =
Thread
(m.test)
28
c =
Thread
(m.test)
29
for
x
in
[a, b, c]:
30
x.start()
31
for
x
in
[c, b, a]:
32
x.join()
33
34
35
def
test_implicit_conversion_no_gil
():
36
a =
Thread
(m.test_no_gil)
37
b =
Thread
(m.test_no_gil)
38
c =
Thread
(m.test_no_gil)
39
for
x
in
[a, b, c]:
40
x.start()
41
for
x
in
[c, b, a]:
42
x.join()
test_thread.Thread
Definition:
test_thread.py:8
test_thread.Thread.run
def run(self)
Definition:
test_thread.py:14
test_thread.Thread.fn
fn
Definition:
test_thread.py:11
test_thread.Thread.e
e
Definition:
test_thread.py:12
test_thread.Thread.__init__
def __init__(self, fn)
Definition:
test_thread.py:9
test_thread.test_implicit_conversion
def test_implicit_conversion()
Definition:
test_thread.py:27
test_thread.test_implicit_conversion_no_gil
def test_implicit_conversion_no_gil()
Definition:
test_thread.py:37
Generated on Tue Aug 12 2025 00:01:03 for μHAL (v2.8.19) by
1.9.5