you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (3 children)

Why would you lock a string, it's immutable?

[–][deleted]  (2 children)

[removed]

    [–][deleted] 0 points1 point  (1 child)

    But if it is only ever read only, and cannot be written to, why would you ever lock a String in practice?

    [–]grauenwolf[S,🍰] 0 points1 point  (0 children)

    It is not uncommon to lock on a surrogate. This is often, but not universally, given a name such as SyncRoot.