---
title: "Difference between atomic, nonatomic @property declarations"  
description: "Difference between atomic, nonatomic @property declarations"  
author: "Anurag Sharma"  
published: 2015-11-15  
updated: 2015-11-17  
canonical: https://www.mindstick.com/forum/33595/difference-between-atomic-nonatomic-property-declarations  
category: "iphone"  
tags: ["iphone", "ios", "objective c"]  
reading_time: 1 minute  

---

# Difference between atomic, nonatomic @property declarations

I have a confusion in @[property](https://www.mindstick.com/blog/205/property-notification-in-c-sharp) declaration between [atomic](https://yourviews.mindstick.com/view/81507/hiroshima-day-remembering-the-story-of-atomic-bombing-which-shook-japan) &[amp](https://www.mindstick.com/forum/156207/what-is-amp); nonatomic?\
For example:

```
@property(nonatomic, retain) UITextField * countryName;@property(atomic, retain) UITextField *countryName;
```

What is the [operational](https://answers.mindstick.com/qa/94144/how-many-days-was-chandrayaan-1-operational) [difference](https://www.mindstick.com/articles/157114/good-news-or-bad-news-and-the-difference-is) between both statements?

## Replies

### Reply by Tarun Kumar

**Here is the difference:**\
**atomic**\
- atomic means only one thread access the variable(static type).\
- atomic is thread safe but it is slow in performance \
- atomic is default behavior\
- atomic accessors in a non garbage collected environment will use a lock to ensure that another thread does not interfere with the correct setting/getting of the value.\
- it is not actually a keyword.\
ForExample:\
@property(retain)NSString *title;\
@synthesize title;

**nonatomic**\
- nonatomic means multiple thread access the variable(dynamic type).\
- nonatomic is thread unsafe.\
- but it is fast in performance\
- nonatomic is NOT default behavior, we need to add nonatomic keyword in property attribute.\
- it may result in unexpected behavior, when two different process (threads) access the same variable at the same time.\
ForExample:\
@property(nonatomic,retain)NSString *title;\
@synthesize title;


---

Original Source: https://www.mindstick.com/forum/33595/difference-between-atomic-nonatomic-property-declarations

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
