c++ ref-count`class thread unsafe

See P65 [[effective stl]]

Compared to detached copies, RC is more thread-sensitive. Threads access shared memory — the counter and counted object.

Consider RC-free containers like vector as a replacement for a RC string.

Kevin of JPMC pointed out that ref-counting smart ptr needs to guard updates to the ref counter.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s