Wait a minute. Do you mean that this code below:
public class MySingleton {
*private* static mySingleton = null;
public static *synchronized* getMySingleton() {
if (mySingleton == null) {
mySingleton = new MySingleton();
}
return mySingleton;
}
does not fix this?
The construction and returning of mySingleton is synchronized *statically*,
on the MySIngleton class. It's true that *every* getXXXX (even when
mySingleton was already constructed) is now synchronized, but it is
thread-safe, i think.
--
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