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

Why doesn’t JavaScript support multithreading?

JavaScript does not support multi-threading because the JavaScript interpreter in the browser is a single thread (AFAIK). Even Google Chrome will not let a single web page’s JavaScript run concurrently because this would cause massive concurrency issues in existing web pages. All Chrome does is separate multiple components (different tabs, plug-ins, etcetera) into separate processes, … Read more

How to pause / sleep thread or process in Android?

One solution to this problem is to use the Handler.postDelayed() method. Some Google training materials suggest the same solution. However, some have pointed out that the solution above causes a memory leak because it uses a non-static inner and anonymous class which implicitly holds a reference to its outer class, the activity. This is a … 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

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 … Read more

Android “Only the original thread that created a view hierarchy can touch its views.”

You have to move the portion of the background task that updates the UI onto the main thread. There is a simple piece of code for this: Documentation for Activity.runOnUiThread. Just nest this inside the method that is running in the background, and then copy paste the code that implements any updates in the middle … Read more