μHAL (v2.8.17)
Part of the IPbus software repository
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Functions | Variables
test_gil_scoped Namespace Reference

Classes

class  ExtendedVirtClass
 

Functions

def _run_in_process (target, *args, **kwargs)
 
def _python_to_cpp_to_python ()
 
def _python_to_cpp_to_python_from_threads (num_threads, parallel=False)
 
def test_python_to_cpp_to_python_from_thread ()
 
def test_python_to_cpp_to_python_from_thread_multiple_parallel ()
 
def test_python_to_cpp_to_python_from_thread_multiple_sequential ()
 
def test_python_to_cpp_to_python_from_process ()
 
def test_cross_module_gil ()
 
def test_callback_py_obj ()
 
def test_callback_std_func ()
 
def test_callback_virtual_func ()
 
def test_callback_pure_virtual_func ()
 
def test_cross_module_gil_released ()
 
def test_cross_module_gil_acquired ()
 
def test_cross_module_gil_inner_custom_released ()
 
def test_cross_module_gil_inner_custom_acquired ()
 
def test_cross_module_gil_inner_pybind11_released ()
 
def test_cross_module_gil_inner_pybind11_acquired ()
 
def test_cross_module_gil_nested_custom_released ()
 
def test_cross_module_gil_nested_custom_acquired ()
 
def test_cross_module_gil_nested_pybind11_released ()
 
def test_cross_module_gil_nested_pybind11_acquired ()
 
def test_release_acquire ()
 
def test_nested_acquire ()
 
def test_multi_acquire_release_cross_module ()
 
def test_all_basic_tests_completeness ()
 
def _intentional_deadlock ()
 
def _run_in_threads (test_fn, num_threads, parallel)
 
def test_run_in_process_one_thread (test_fn)
 
def test_run_in_process_multiple_threads_parallel (test_fn)
 
def test_run_in_process_multiple_threads_sequential (test_fn)
 
def test_run_in_process_direct (test_fn)
 

Variables

 VARS_BEFORE_ALL_BASIC_TESTS = dict(vars())
 
tuple ALL_BASIC_TESTS
 
tuple ALL_BASIC_TESTS_PLUS_INTENTIONAL_DEADLOCK = ALL_BASIC_TESTS + (_intentional_deadlock,)
 

Function Documentation

◆ _intentional_deadlock()

def test_gil_scoped._intentional_deadlock ( )
private

Definition at line 143 of file test_gil_scoped.py.

◆ _python_to_cpp_to_python()

def test_gil_scoped._python_to_cpp_to_python ( )
private
Calls different C++ functions that come back to Python.

Definition at line 22 of file test_gil_scoped.py.

◆ _python_to_cpp_to_python_from_threads()

def test_gil_scoped._python_to_cpp_to_python_from_threads (   num_threads,
  parallel = False 
)
private
Calls different C++ functions that come back to Python, from Python threads.

Definition at line 39 of file test_gil_scoped.py.

◆ _run_in_process()

def test_gil_scoped._run_in_process (   target,
args,
**  kwargs 
)
private

◆ _run_in_threads()

def test_gil_scoped._run_in_threads (   test_fn,
  num_threads,
  parallel 
)
private

Definition at line 193 of file test_gil_scoped.py.

◆ test_all_basic_tests_completeness()

def test_gil_scoped.test_all_basic_tests_completeness ( )

Definition at line 133 of file test_gil_scoped.py.

References len().

◆ test_callback_pure_virtual_func()

def test_gil_scoped.test_callback_pure_virtual_func ( )

Definition at line 33 of file test_gil_scoped.py.

◆ test_callback_py_obj()

def test_gil_scoped.test_callback_py_obj ( )

Definition at line 20 of file test_gil_scoped.py.

◆ test_callback_std_func()

def test_gil_scoped.test_callback_std_func ( )

Definition at line 24 of file test_gil_scoped.py.

◆ test_callback_virtual_func()

def test_gil_scoped.test_callback_virtual_func ( )

Definition at line 28 of file test_gil_scoped.py.

◆ test_cross_module_gil()

def test_gil_scoped.test_cross_module_gil ( )
Makes sure that the GIL can be acquired by another module from a GIL-released state.

Definition at line 92 of file test_gil_scoped.py.

◆ test_cross_module_gil_acquired()

def test_gil_scoped.test_cross_module_gil_acquired ( )
Makes sure that the GIL can be acquired by another module from a GIL-acquired state.

Definition at line 43 of file test_gil_scoped.py.

◆ test_cross_module_gil_inner_custom_acquired()

def test_gil_scoped.test_cross_module_gil_inner_custom_acquired ( )
Makes sure that the GIL can be acquired/acquired by another module
from a GIL-acquired state using custom locking logic.

Definition at line 54 of file test_gil_scoped.py.

◆ test_cross_module_gil_inner_custom_released()

def test_gil_scoped.test_cross_module_gil_inner_custom_released ( )
Makes sure that the GIL can be acquired/released by another module
from a GIL-released state using custom locking logic.

Definition at line 48 of file test_gil_scoped.py.

◆ test_cross_module_gil_inner_pybind11_acquired()

def test_gil_scoped.test_cross_module_gil_inner_pybind11_acquired ( )
Makes sure that the GIL can be acquired/acquired by another module
from a GIL-acquired state using pybind11 locking logic.

Definition at line 66 of file test_gil_scoped.py.

◆ test_cross_module_gil_inner_pybind11_released()

def test_gil_scoped.test_cross_module_gil_inner_pybind11_released ( )
Makes sure that the GIL can be acquired/released by another module
from a GIL-released state using pybind11 locking logic.

Definition at line 60 of file test_gil_scoped.py.

◆ test_cross_module_gil_nested_custom_acquired()

def test_gil_scoped.test_cross_module_gil_nested_custom_acquired ( )
Makes sure that the GIL can be nested acquired/acquired by another module
from a GIL-acquired state using custom locking logic.

Definition at line 78 of file test_gil_scoped.py.

◆ test_cross_module_gil_nested_custom_released()

def test_gil_scoped.test_cross_module_gil_nested_custom_released ( )
Makes sure that the GIL can be nested acquired/released by another module
from a GIL-released state using custom locking logic.

Definition at line 72 of file test_gil_scoped.py.

◆ test_cross_module_gil_nested_pybind11_acquired()

def test_gil_scoped.test_cross_module_gil_nested_pybind11_acquired ( )
Makes sure that the GIL can be nested acquired/acquired by another module
from a GIL-acquired state using pybind11 locking logic.

Definition at line 90 of file test_gil_scoped.py.

◆ test_cross_module_gil_nested_pybind11_released()

def test_gil_scoped.test_cross_module_gil_nested_pybind11_released ( )
Makes sure that the GIL can be nested acquired/released by another module
from a GIL-released state using pybind11 locking logic.

Definition at line 84 of file test_gil_scoped.py.

◆ test_cross_module_gil_released()

def test_gil_scoped.test_cross_module_gil_released ( )
Makes sure that the GIL can be acquired by another module from a GIL-released state.

Definition at line 38 of file test_gil_scoped.py.

◆ test_multi_acquire_release_cross_module()

def test_gil_scoped.test_multi_acquire_release_cross_module ( )

Definition at line 104 of file test_gil_scoped.py.

References len().

◆ test_nested_acquire()

def test_gil_scoped.test_nested_acquire ( )

Definition at line 100 of file test_gil_scoped.py.

◆ test_python_to_cpp_to_python_from_process()

def test_gil_scoped.test_python_to_cpp_to_python_from_process ( )
Makes sure there is no GIL deadlock when using processes.

This test is for completion, but it was never an issue.

Definition at line 84 of file test_gil_scoped.py.

References _run_in_process().

◆ test_python_to_cpp_to_python_from_thread()

def test_gil_scoped.test_python_to_cpp_to_python_from_thread ( )
Makes sure there is no GIL deadlock when running in a thread.

It runs in a separate process to be able to stop and assert if it deadlocks.

Definition at line 55 of file test_gil_scoped.py.

References _run_in_process().

◆ test_python_to_cpp_to_python_from_thread_multiple_parallel()

def test_gil_scoped.test_python_to_cpp_to_python_from_thread_multiple_parallel ( )
Makes sure there is no GIL deadlock when running in a thread multiple times in parallel.

It runs in a separate process to be able to stop and assert if it deadlocks.

Definition at line 64 of file test_gil_scoped.py.

References _run_in_process().

◆ test_python_to_cpp_to_python_from_thread_multiple_sequential()

def test_gil_scoped.test_python_to_cpp_to_python_from_thread_multiple_sequential ( )
Makes sure there is no GIL deadlock when running in a thread multiple times sequentially.

It runs in a separate process to be able to stop and assert if it deadlocks.

Definition at line 73 of file test_gil_scoped.py.

References _run_in_process().

◆ test_release_acquire()

def test_gil_scoped.test_release_acquire ( )

Definition at line 96 of file test_gil_scoped.py.

◆ test_run_in_process_direct()

def test_gil_scoped.test_run_in_process_direct (   test_fn)
Makes sure there is no GIL deadlock when using processes.

This test is for completion, but it was never an issue.

Definition at line 239 of file test_gil_scoped.py.

References _run_in_process().

◆ test_run_in_process_multiple_threads_parallel()

def test_gil_scoped.test_run_in_process_multiple_threads_parallel (   test_fn)
Makes sure there is no GIL deadlock when running in a thread multiple times in parallel.

It runs in a separate process to be able to stop and assert if it deadlocks.

Definition at line 219 of file test_gil_scoped.py.

References _run_in_process().

◆ test_run_in_process_multiple_threads_sequential()

def test_gil_scoped.test_run_in_process_multiple_threads_sequential (   test_fn)
Makes sure there is no GIL deadlock when running in a thread multiple times sequentially.

It runs in a separate process to be able to stop and assert if it deadlocks.

Definition at line 229 of file test_gil_scoped.py.

References _run_in_process().

◆ test_run_in_process_one_thread()

def test_gil_scoped.test_run_in_process_one_thread (   test_fn)
Makes sure there is no GIL deadlock when running in a thread.

It runs in a separate process to be able to stop and assert if it deadlocks.

Definition at line 209 of file test_gil_scoped.py.

References _run_in_process().

Variable Documentation

◆ ALL_BASIC_TESTS

tuple test_gil_scoped.ALL_BASIC_TESTS
Initial value:
1= (
2 test_callback_py_obj,
3 test_callback_std_func,
4 test_callback_virtual_func,
5 test_callback_pure_virtual_func,
6 test_cross_module_gil_released,
7 test_cross_module_gil_acquired,
8 test_cross_module_gil_inner_custom_released,
9 test_cross_module_gil_inner_custom_acquired,
10 test_cross_module_gil_inner_pybind11_released,
11 test_cross_module_gil_inner_pybind11_acquired,
12 test_cross_module_gil_nested_custom_released,
13 test_cross_module_gil_nested_custom_acquired,
14 test_cross_module_gil_nested_pybind11_released,
15 test_cross_module_gil_nested_pybind11_acquired,
16 test_release_acquire,
17 test_nested_acquire,
18 test_multi_acquire_release_cross_module,
19)

Definition at line 112 of file test_gil_scoped.py.

◆ ALL_BASIC_TESTS_PLUS_INTENTIONAL_DEADLOCK

tuple test_gil_scoped.ALL_BASIC_TESTS_PLUS_INTENTIONAL_DEADLOCK = ALL_BASIC_TESTS + (_intentional_deadlock,)

Definition at line 147 of file test_gil_scoped.py.

◆ VARS_BEFORE_ALL_BASIC_TESTS

test_gil_scoped.VARS_BEFORE_ALL_BASIC_TESTS = dict(vars())

Definition at line 111 of file test_gil_scoped.py.