Is this still the case ? Anyone went through ? There is some confusion on 
this floating around:

http://stackoverflow.com/questions/4693387/sharedpreferences-and-thread-safety

On Tuesday, February 24, 2009 5:39:17 AM UTC, rod wrote:
>
> It appears to me that the SharedPreferences implementation is NOT 
> thread safe. 
>
> The implementations of Context.getSharedPreferences() and Editor.commit 
> () do not synchronize on the same monitor. 
>
> A call to getSharedPreferences() can return a new empty instance if 
> there is a concomitant thread in the process of committing. 
>
> In this case the getSharedPreferences() call may see the underlying 
> preference file as changed. Should it see the file is changed and 
> subsequently load the file from disk while it is unable to read or 
> reads an invalid (only partially written file), it will fail silently 
> and return a new instance. 
>
> I see many posts suggesting that it is thread safe, not multi-process 
> safe. But there's no shortage of folk reporting sporadic loss of 
> preferences in a multi-threaded application. Perhaps i'm not correctly 
> reading the source... Does anyone concur? 
>
> Thanks, 
> Rod 
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to