Statistics: pthread shared memory cleanup

This wires up cleanup code for the shared memory statistics. 
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 in 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.