This is an archive of the discontinued LLVM Phabricator instance.

Summary: Fix race condition in std::atomic_store for std::shared_ptr.
ClosedPublic

Authored by halyavin on Apr 21 2017, 6:47 AM.

Details

Summary

The function __libcpp_mutex_trylock returns true/false instead of integer
like pthread_mutex_trylock.

Event Timeline

halyavin created this revision.Apr 21 2017, 6:47 AM
halyavin retitled this revision from Summary: Fix race condition is std::atomic_store for std::shared_ptr. to Summary: Fix race condition in std::atomic_store for std::shared_ptr..Apr 23 2017, 11:35 AM
EricWF edited edge metadata.May 3 2017, 1:25 PM

Wow that's my bad. I thought I fixed up all callers of __libcpp_mutex_trylock. However it's shocking we didn't have a test that uncovered this. Do you think you can write a test for this?

Unfortunately, I can't write deterministic test.

EricWF accepted this revision.May 3 2017, 2:04 PM
This revision is now accepted and ready to land.May 3 2017, 2:04 PM

Thank you. Could you commit this patch for me?

EricWF closed this revision.May 4 2017, 12:58 AM

Committed in r302129.