Bug 23926 - Race condition in callOnMainThreadAndWait
Summary: Race condition in callOnMainThreadAndWait
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: David Levin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-12 10:03 PST by David Levin
Modified: 2009-02-13 01:29 PST (History)
2 users (show)

See Also:


Attachments
Patch for bug. (1.84 KB, patch)
2009-02-12 10:24 PST, David Levin
no flags Details | Formatted Diff | Diff
Patch to remove unused function. (2.99 KB, patch)
2009-02-12 14:18 PST, David Levin
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Levin 2009-02-12 10:03:50 PST
In callOnMainThreadAndWait, if MainThreadFunction finishes before the wait is entered, then the sync() call has no effect. (Thanks to Alexey for pointing out the same problem elsewhere.)
Comment 1 David Levin 2009-02-12 10:24:55 PST
Created attachment 27606 [details]
Patch for bug.
Comment 2 Dmitry Titov 2009-02-12 10:40:26 PST
It would be nice to change callOnMainThread function to match the same style too (remove local scope for the mutex and needToSchedule variable).
Comment 3 David Levin 2009-02-12 12:51:59 PST
Comment on attachment 27606 [details]
Patch for bug.

Retracting while I consider dimich's suggestion.
Comment 4 David Levin 2009-02-12 14:18:51 PST
Created attachment 27623 [details]
Patch to remove unused function.

callOnMainThreadAndWait isn't used and it has a race in it.
Comment 5 Darin Adler 2009-02-12 14:42:23 PST
Comment on attachment 27623 [details]
Patch to remove unused function.

r=me

Seems to me we can add a version without the race if we find we need it for something.
Comment 6 Alexey Proskuryakov 2009-02-13 01:29:43 PST
Committed revision 40969.