This is an archive of the discontinued LLVM Phabricator instance.

[NFC][DirectoryWatchedTests] Unlocking mutexes before signaling condition variable.
ClosedPublic

Authored by plotfi on Aug 3 2019, 6:36 PM.

Details

Summary

This should not affect actual behavior, but should pessimize the threading less by avoiding the situation where:

  • mutex is still locked
  • T1 notifies on condition variable
  • T2 wakes to check mutex
  • T2 sees mutex is still locked
  • T2 waits
  • T1 unlocks mutex
  • T2 tries again, acquires mutex.

Diff Detail

Event Timeline

plotfi created this revision.Aug 3 2019, 6:36 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 3 2019, 6:36 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript

LGTM. Thanks!

This revision was not accepted when it landed; it landed in state Needs Review.Aug 5 2019, 6:30 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptAug 5 2019, 6:30 PM