Writing thread-safe code is in itself a major challenge and add to that the challenge of verifying if the code…