01-13-2011 09:36 AM
I've seen various examples where the runtimestore is synchronized, it includes official blackberry knowledgebase:
01-13-2011 09:40 AM
01-13-2011 09:47 AM
Usually the code within the sync should be quite short, yes.
However, if let's say I'm talking about a malicious application that specifically tries to lock other applications...
01-13-2011 09:53 AM
01-17-2011 08:34 AM - edited 01-17-2011 08:36 AM
Anyone? Mark S? I still believe synchronizing on the RuntimeStore makes your app vulnerable to being deadlocked by another app, but since it is a practice documented in the knowledge base, need someone to confirm whether I can read to and write from the RuntimeStore without synchronization and without corrupting it.
My tests cannot confirm anything because there's always the chance I'm just being lucky when it comes to race conditions.
01-20-2011 10:04 AM
Sorry for bumping my post. Is there anyone who knows how the RuntimeStore should be used can let us know whether synchronization is required?
Can I trust the example code in the knowledge base, where access need synchronization?
And if I must synchronize on the RuntimeStore, how can applications make sure they won't be deadlocked by another badly-written application?
01-20-2011 10:09 AM
in the past years i have never encountered an issue by not synchronizing the runtimestore.
I think your concerns are valid, albeit the scenario is not very likely.
01-20-2011 10:34 AM
I have already stopped syncing. A lot of apps still seems to be doing this, an example is the Docs to Go Suite - they locked up when I ran my badly written application.
The much more concerning aspect of my question is whether I can rely anymore on codes posted on the developer knowledge base as the final authority on how things should be written in the absence of examples in the Javadoc.
01-20-2011 11:08 AM
Most developers working for RIM are experienced and write good code, but not all code examples should be taken as the ultimate solution (good is not always the same as the best).
I have improved some RIM samples myself, some do not adhere to naming conventions or are badly documented...
Some samples are also very old, and there may be better ways to achieve things then with the 3.6 API.
I trust RIM samples to be working correctly, but all software may contain bugs, even after being tested.
And I take them as samples, not as a rule about how to write my own code.
I guess you can go ahead and PM Mark Sohm or Garett Beukeboom with your specific question about the synchronized, but i doubt that there are any special secrets to be gained there.
Synchronization makes you safe against some problems while making you vulnerable to others, if there was no tradeoff all code would use it.