Merge pull request #4 from alorence/ea3970980625f996908e052aa742b69f7c0b64ca

Fix issue #3: unlock mutex before deleting its parent
Allow library to be built statically