Refactor MicroLock and remove its slots
Summary: `folly::MicroLock` is actually 4 locks in one. Turns out that it's not very useful considering there is not a single use in fbcode. Instead `MicroLock` should allow a nicer API for exposing the 6 unused bits as user data. By limiting the lock to one slot (least significant 2 bits), we can make the assumption that the 6 contiguous most significant bits are user data. This means that all the masking logic can go away (see `slotMask` and `LockGuardWithDataSlots`). Now `lockAndLoad`, `unlockAndStore`, `LockGuardWithData` "just work" with needing to worry about user data interfering with the slots used for locking. Reviewed By: davidtgoldblatt Differential Revision: D25909068 fbshipit-source-id: 3f050fa7393b40cff949ed6e30b691d7f40d0edf
Showing
This diff is collapsed.
Please register or sign in to comment