Swift doesn't really have a nice locking API. We should write one. http://www.bignerdranch.com/blog/locking-in-swift-helping-protect-me-from-myself/ has a nice example one.
Created attachment 8524317 [details] [review] Pull request
I'm not against having this but I think we need to try to avoid using special Locking as much as possible. In general you are either on the Main thread or on the UI thread. Operations should generally happen on the main thread. Or if they can take a while on one of the predefined queues that the system gives us. The main thread executes blocks serially, so if we are consistent and schedule work there, then there should mostly be no need for locking resources.
Comment on attachment 8524317 [details] [review] Pull request Yeah, Wes and I have been talking about threading in Swift over the past couple days, and I think we agree that we should be breaking up critical sections into tasks that are handed off to GCD. I think we'll be dropping this and updating bug 8524345 to use GCD, so removing review.
(In reply to Brian Nicholson (:bnicholson) from comment #3) > I think we'll be dropping this and updating bug 8524345 to use GCD, so > removing review. Oops, I copied the attachment # instead of the bug #. I meant bug 1094317.
I talked to brian about this again today for a bit. I like having a locking API TBH, but I'd like to sit down at the work week and look at other better solutions.
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
Component: General → General
OS: All → iOS 7
Product: Firefox for Android → Firefox for iOS
You need to log in before you can comment on or make changes to this bug.