| Summary: | Add support for better "try-lock" pattern for Locker<Lock> | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Chris Dumez <cdumez> | ||||||||||
| Component: | Web Template Framework | Assignee: | Chris Dumez <cdumez> | ||||||||||
| Status: | ASSIGNED --- | ||||||||||||
| Severity: | Normal | CC: | benjamin, calvaris, cmarcelo, darin, eric.carlson, ews-watchlist, ggaren, glenn, hta, jer.noble, kkinnunen, philipj, pnormand, sam, sergio, tommyw, vjaquez, webkit-bug-importer | ||||||||||
| Priority: | P2 | Keywords: | InRadar | ||||||||||
| Version: | WebKit Nightly Build | ||||||||||||
| Hardware: | Unspecified | ||||||||||||
| OS: | Unspecified | ||||||||||||
| Attachments: |
|
||||||||||||
Created attachment 429536 [details]
WIP Patch
Very minimal patch for now as EWS didn't like it last time I tried this approach.
Created attachment 429537 [details]
WIP Patch
Created attachment 429540 [details]
WIP Patch (more complete)
Created attachment 429542 [details]
WIP Patch (more complete)
Comment on attachment 429542 [details] WIP Patch (more complete) View in context: https://bugs.webkit.org/attachment.cgi?id=429542&action=review > Source/WebCore/Modules/speech/SpeechRecognitionCaptureSourceImpl.cpp:88 > + Locker locker { DeferLock, m_dataSourceLock }; ./Modules/speech/SpeechRecognitionCaptureSourceImpl.cpp:109:5: error: writing variable 'm_dataSource' requires holding mutex 'm_dataSourceLock' exclusively [-Werror,-Wthread-safety-analysis] EWS gets this error. I don't see what I am doing wrong here and this works fine locally :/ Add https://bugs.webkit.org/attachment.cgi?id=429537&action=prettypatch was building fine so the pattern seems to be working, at least in some cases.. |
Add support for better "try-lock" pattern for Locker<Lock>. Maybe: ``` Locker locker { DeferLock, m_lock }; if (!locker.tryLock()) return; // Do something. ``` I think it would be nicer than the current: ``` if (!m_lock.tryLock()) return; Locker locker { AdoptLock, m_lock }; // Do something. ```