Hi all,
We have a very typical problem. There’s a model that can be updated from a thread and in the same time this model is displayed on the screen (in the UI thread). So the question is how to syncronize the common state (in this case the model. As far as we see the synchonized blocks are commented after cross-compilation to Objective C and we are not sure whether volatile is supported either. Can you point us to techniques for syncronization using MobileDesigner?
Volatile is not currently supported, however standard synchronization should work. Whilst you do indeed see a commented out block of the form
//synchronized(my_obj)
in the converting C++ code, this is simply preserved for informational purposes. You should also see a line or so later something of the form:
MS_START_SYNC_LOCK(my_obj)
This does result in synchronisation.
Please note though that it’s best not to drip-feed information into the UI in small changes - a number of computational calculations must be performed each time the general UI layout is changed. Whilst changing this repeatedly should work, you may notice a performance degradation as a side effect if done too frequently. Instead, it might be better to display a ‘progress’ animation to the user to show data is being retrieved from a server / updated on the device, and then update the UI in one block when ready.