Run code on UI thread in WinRT

It’s easier to directly get the CoreWindow from the non-UI thread. The following code will work everywhere, even when GetForCurrentThread() or Window.Current returns null. CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, <lambda for your code which should run on the UI thread>); for example: CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { // Your UI update code goes here! }); You’ll need to reference Windows.ApplicationModel.Core …

Read more

Core Data multi thread application

The Apple Concurrency with Core Data documentation is the place to start. Read it really carefully… I was bitten many times by my misunderstandings! Basic rules are: Use one NSPersistentStoreCoordinator per program. You don’t need them per thread. Create one NSManagedObjectContext per thread. Never pass an NSManagedObject on a thread to the other thread. Instead, …

Read more

Java thread affinity

You can’t do this in pure java. But if you really need it — you can use JNI to call native code which do the job. This is the place to start with: http://ovatman.blogspot.com/2010/02/using-java-jni-to-set-thread-affinity.html http://blog.toadhead.net/index.php/2011/01/22/cputhread-affinity-in-java/ UPD: After some thinking, I’ve decided to create my own class for this: ThreadAffinity.java It’s JNA-based, and very simple — …

Read more

Will a browser give an iframe a separate thread for JavaScript?

Recently tested if JavaScript running in a iFrame would block JavaScript from running in the parent window. iFrame on same domain as parent: Chrome 68.0.3440.84: Blocks Safari 11.0.2 (13604.4.7.1.3): Blocks Safari 15.1 on iOS: Blocks Firefox 96: Blocks iFrame on different domain as parent Chrome 68.0.3440.84: Doesn’t block Safari 11.0.2 (13604.4.7.1.3): Blocks (outdated, but I …

Read more