Hi,

Attached is an example of how StringBuilder could be made thread safe
and still enable sharing the char[]. Unfortunately it requires
allocating an extra temp object and JIT magic, but maybe someone is
interested in pursuing this (I'm not because I have to special case
StringBuilder in another way).

Note that you could also get rid of the temporary object by using a
String instance for this, but that would require making the value and
count fields of String non-final and this has memory model consequences
as well (thereby making String non-portable).

Regards,
Jeroen

Attachment: StringBuilder.java
Description: StringBuilder.java

_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/classpath

Reply via email to