shared-mem-locks: clean up shared memory segments

This wires up cleanup code shared memory segments.
It uses slightly modified copies of pthread_shared_mem.cc/h, containing a change
proposal to support our ordering of events during a configuration reload.

It can be tested and reviewed through this branch.

I did some extensive tests, it seems segment cleanup is not perfect yet
(segments for named locks, per vhost statistics segments). I think we need to
fix that in the trunk-tracking branch or in a separate pull though. It seems the
current trunk of psol has improvements that may fix this, and fixing it in this
pull will make it larger and more complex then I would like it to be.

Squash-merge of Otto's #179.