[swift-dev] Thread safety of weak properties

Kevin Ballard kevin at sb.org
Tue Dec 15 20:27:56 CST 2015


On Tue, Dec 15, 2015, at 06:12 PM, John McCall wrote:
> So, just to complete the loop here: absent Darwin granting public and backwards-compatible access to an internal API, we need to write this in a way that falls back on using a heavyweight lock in the presence of contention.  I’m fine with that being a global lock.

Well, no, the activity count idea isn't a spinlock and is perfectly safe. It's actually basically a retain count, but it's protecting write access to the field rather than protecting an object.

> Note that Darwin platforms need this to interoperate with the unknownWeak entrypoints.

What does that interoperation look like?

-Kevin Ballard


More information about the swift-dev mailing list