(ios) Create a general locking api

RESOLVED FIXED

Status

()

Firefox for iOS
General
RESOLVED FIXED
4 years ago
3 years ago

People

(Reporter: wesj, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

4 years ago
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.
(Reporter)

Updated

4 years ago
Group: mozilla-employee-confidential
(Reporter)

Comment 1

4 years ago
Created attachment 8524317 [details] [review]
Pull request
Attachment #8524317 - Flags: review?(bnicholson)
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.
Attachment #8524317 - Flags: review?(bnicholson)
(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.
(Reporter)

Comment 5

3 years ago
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.
(Reporter)

Updated

3 years ago
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
Group: mozilla-employee-confidential
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.