| 52 | |
| 53 | @pytest.mark.skipif(sys.platform.startswith("emscripten"), reason="Requires threads") |
| 54 | def test_bind_shared_instance(): |
| 55 | nb_threads = 4 |
| 56 | b = threading.Barrier(nb_threads) |
| 57 | |
| 58 | def access_shared_instance(): |
| 59 | b.wait() |
| 60 | for _ in range(1000): |
| 61 | m.EmptyStruct.SharedInstance # noqa: B018 |
| 62 | |
| 63 | threads = [ |
| 64 | threading.Thread(target=access_shared_instance) for _ in range(nb_threads) |
| 65 | ] |
| 66 | for thread in threads: |
| 67 | thread.start() |
| 68 | for thread in threads: |
| 69 | thread.join() |
| 70 | |
| 71 | |
| 72 | @pytest.mark.skipif(sys.platform.startswith("emscripten"), reason="Requires threads") |