Merge pull request #241 from ffried/swift-3.1-branch

[Cherry Pick] lock: Avoid use of undefined DISPATCH_INTERNAL_CRASH