[webkit-dev] Strings on multiple threads

Jeremy Orlow jorlow at chromium.org
Thu Dec 3 17:21:44 PST 2009


Handling strings on multiple threads is driving me crazy.  There are so many
subtleties about what's safe and what's not I'm wondering if it makes sense
to just make a thread safe class.

For example, String1 + String2 is not safe if either of those threads is
from another thread (since if either string is empty, it'll just point to
the other strings StringImpl).  Another example: if you have a class that
isn't always destroyed on the same thread and anything is making a copy of a
string it owns and that copy might outlive the class, the copy has to be
thread safe.

I understand that making all strings ThreadSafeShared is completely out of
the question, but maybe we can make another class of strings that is safe?
 Maybe we can even do it in a way that still shares the majority of the
existing string code?  (Ideally without resorting to templates.)

I'm asking here before looking at this seriously since I'm guessing this has
come up before and/or there are good reasons why this hasn't been done
before.

Thanks,
J
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20091203/44d733e2/attachment.html>


More information about the webkit-dev mailing list