>
WTF::Lock and WTF::Condition only require one byte of storage each. WTF::Lock only needs two bits in that byte.Packing several unrelated, highly contended mutexes into the same 32 bit word is probably not a good idea, though. :)
This reminds me of early Unix and its "wait channels", which were just addresses, not even objects. A process could wait, specifying the address of any object whatsoever as a "channel". A wakeup for that address would resume it. This required no storage in the addressed object itself; the extra paraphernalia required for it was associated by a hash or whatever. And of course that paraphernalia is transient; an object that nobody is waiting on doesn't need it.