[swift-dev] Thread safety of weak properties

Mike Ash mike at mikeash.com
Mon Dec 14 21:51:55 CST 2015


> On Dec 14, 2015, at 3:19 PM, Greg Parker via swift-dev <swift-dev at swift.org> wrote:
> 
> 
>> On Dec 14, 2015, at 9:47 AM, John McCall via swift-dev <swift-dev at swift.org> wrote:
>> 
>>> On Dec 12, 2015, at 7:04 PM, Chris Lattner <clattner at apple.com> wrote:
>>> #3 sounds like a great approach to me.  I agree with Kevin that if we keep the object husk approach that any use of a weak pointer that returns nil should drop any reference to a husk.
>> 
>> Spin locks are, unfortunately, illegal on iOS, which does not guarantee progress in the face of priority inversion.
> 
> There is a spinlock algorithm that does work (in practice if not in theory), but it requires a full word of storage instead of a single bit.

Do you have a pointer (unintentional pun, oops) to this algorithm?

In this case, if we're going to dedicate a whole word to it, then we might as well go with the activity count implementation, but I'd be curious to read more just the same.

Mike


More information about the swift-dev mailing list