What does threadsafe mean?

Eric Lippert has a nice blog post entitled What is this thing you call “thread safe”? about the definition of thread safety as found of Wikipedia. 3 important things extracted from the links : “A piece of code is thread-safe if it functions correctly during simultaneous execution by multiple threads.” “In particular, it must satisfy the need for … Read more

PyQt is thread-safe to the same extent that Qt is thread-safe. The Qt docs will tell you which parts of their API are guaranteed to be so, and under what circumstances.

Cross-thread signals are thread-safe, so calling the updatePB method in your example is okay. Your ConnDisconn method is not thread-safe, but that has got nothing to do with PyQt or Qt – it’s just a consequence of how you wrote it. The serialEnabled attribute could be read/written by two threads simultaneously, so the behaviour is strictly undefined. A thread-safe way of … Read more

Why does PyQt crashes without information? (exit code 0xC0000409)

PyQt is thread-safe to the same extent that Qt is thread-safe. The Qt docs will tell you which parts of their API are guaranteed to be so, and under what circumstances. Cross-thread signals are thread-safe, so calling the updatePB method in your example is okay. Your ConnDisconn method is not thread-safe, but that has got nothing to do with … Read more

Collection was modified; enumeration operation may not execute

What’s likely happening is that SignalData is indirectly changing the subscribers dictionary under the hood during the loop and leading to that message. You can verify this by changing To If I’m right, the problem will disappear. Calling subscribers.Values.ToList() copies the values of subscribers.Values to a separate list at the start of the foreach. Nothing else has access to this list (it … Read more