Re-integrate pthread-bos changes at 267a362efb262e79eefc684cf6cddf5241443498

We were segfaulting the bosserver while trying to write out a new
BosConfig, with the old code.

Change-Id: I833ff818b2e40697a4d7bbb330570c8e7d7f4d14