Skip to content

Threading is bad style/inefficient #91

@uliwitness

Description

@uliwitness

This code could use some improvement: Currently it starts its own thread to download the data, then starts a synchronous request (which in turn starts its own thread and blocks until that returns). What this should really do is just use one of the asynchronous networking calls (or even better, use NSURLSession's asynchronous calls to fetch the current app version from the app store)

It also does several performSelectorOnMainThread: calls after one another. Each such call has an overhead. It would be much cleaner if it just did one performSelectorOnMainThread: and had that call one method that does the 4 or so calls that need to be on the main thread.

Finally, the way it creates the singleton in +load with performSelectorOnMainThread: waitUntilDone: NO has a race condition. This should really just be using dispatch_once like one does these days to set up a singleton thread-safely.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions