Merging locks from cpp-mutex branch into cpp-queued branch.

As per comment in https://github.com/libpd/libpd/pull/68