How to make a code snippet thread safe?



How to make a code snippet thread safe?..

Answer / Ashish Gotra

To make a code snippet thread-safe, use locks such as @synchronized(), NSConditionLock, or NSLock. Another approach is using Grand Central Dispatch (GCD) operations and data structures like dispatch queues and semaphores.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Objective-C Interview Questions

Is objective c and c the same?

1 Answers  


What is a .m file in xcode?

1 Answers  


What is a selector objective c?

1 Answers  


What is objective c vs c?

1 Answers  


What is a nsstring?

1 Answers  


Can you learn swift without knowing objective c?

1 Answers  


What is the difference between function and objective?

1 Answers  


Explain application life cycle or application states?

1 Answers  


Mention whether nsobject is a parent class or derived class.

1 Answers  


What are kvc and kvo? Provide an example.

1 Answers  


What does __ block do?

1 Answers  


Is objective c faster than swift?

1 Answers  


Categories