[swift-dev] Thread safety of weak properties
clattner at apple.com
Sat Dec 12 21:04:25 CST 2015
#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.
> On Dec 11, 2015, at 7:00 AM, Mike Ash via swift-dev <swift-dev at swift.org> wrote:
> 3. Borrow a bit from the weak pointer to implement a spinlock. This is really a special case of (2), with the activity count being capped at 1 and additional activity blocking. In fact, you could even do a hybrid approach by borrowing more bits. (I think it could safely steal up to 20 bits with current 64-bit architectures. This may not be wise. As long as targets are pointer-aligned you can safely steal 2/3 bits.)
More information about the swift-dev