Read-write lock pools

#include <x/lockpool.H>

typedef x::rwlockpool<> rwpool_t;

rwpool_t rwlockpool(rwpool_t::create());

rwpool_t::lockentry rlock(rwlockpool->addLockSet(rwpool_t::readlock,
                                                 x::eventfd::create());

rwpool_t::lockentry rlock(rwlockpool->addLockSet(rwpool_t::writelock,
                                                 x::eventfd::create());

x::rwlockpool is a specialization of a lock pool that implements the semantics of x::rwmutex. The single template parameter specifies the lock starvation option. In this specialization, the default starve value is false. Once a write lock is in the lock pool's waiting list, any subsequent read locks queue up on the waiting list until all existing read locks go out of scope, permitting the waiting write lock to acquire the lock pool. This ensures that the write lock will eventually be acquired.

Setting starve to true results in read locks starving the pending write locks as long as at least one read lock exists, until all read locks go out of scope.