Howard
Howard

Reputation: 19825

Should iPhone app need be thread safe?

I don't use thread explicitly, so when designing an iPhone app, e.g. using Singleton, should I need to take care of the thread issue?

Upvotes: 1

Views: 141

Answers (2)

Nick Cartwright
Nick Cartwright

Reputation: 8274

In the most part you should be safe, but I would be aware that even if you don't use threads explicitly, there are many libraries in the Apple SDK that have asynchronous callbacks (such as HTTP requests) where you will need to synchronize access across shared memory.

Upvotes: 2

hotpaw2
hotpaw2

Reputation: 70743

Beware of a singleton being called by or using any OS classes that could become multi-threaded on future multi-core hardware. Also beware of forgetting that this class isn't thread safe N years from now, reusing it, and wasting your life hunting the bug.

If not, no.

Upvotes: 5

Related Questions