4 ms·
This paper is worth reading; an implementation detail that may be useful to many is their use of reference counting: negative refcount is used to indicate threa
by vnorilo 6y ago
This paper is worth reading; an implementation detail that may be useful to many is their use of reference counting: negative refcount is used to indicate thread-shared objects. Releasing objects goes fast path with a single branch when refcount > 1, performing a non-atomic decrement. The slow path handles freeing memory, atomic counter mutation, and a sticky object flag encoded as overflow-by-one.