Questions tagged [nonatomic]

The tag has no usage guidance.

nonatomic
Filter by
Sorted by
Tagged with
1947 votes
28 answers
534k views

What's the difference between the atomic and nonatomic attributes?

What do atomic and nonatomic mean in property declarations? @property(nonatomic, retain) UITextField *userName; @property(atomic, retain) UITextField *userName; @property(retain) UITextField *...
Alex Wayne's user avatar
  • 183k
11 votes
5 answers
8k views

Will atomic operations block other threads?

I am trying to make "atomic vs non atomic" concept settled in my mind. My first problem is I could not find "real-life analogy" on that. Like customer/restaurant relationship over atomic operations or ...
Teoman shipahi's user avatar
10 votes
3 answers
6k views

Objective-c properties for primitive types

In Objective-C Does it ever make sense to specify a property for a primitive type as nonatomic? I'm wondering about the difference between these two properties: @property (nonatomic) BOOL myBool; @...
SundayMonday's user avatar
  • 19.4k
8 votes
1 answer
557 views

Atomic access to non-atomic memory location in C++11 and OpenMP?

OpenMP, in contrast to C++11, works with atomicity from a perspective of memory operations, not variables. That allows, e.g., to use atomic reads/writes for integers being stored in a vector with ...
Daniel Langr's user avatar
  • 22.8k
7 votes
3 answers
2k views

Objective-C: Defaults to atomic for scalar properties?

A friend told me that the @property default for scalar properties (BOOL, NSInteger, etc.) is nonatomic. I.e., @property BOOL followVenmo; defaults to @property (nonatomic) BOOL followVenmo; But, I ...
ma11hew28's user avatar
  • 124k
5 votes
1 answer
69 views

How to remove function from list in R?

I have list with two functions: foo <- function() { print('foo') } bar <- function() {} l <- list(foo, bar) How can I remove function foo without knowing its index? I've tried this (to get ...
jcubic's user avatar
  • 64.3k
5 votes
1 answer
470 views

Difference between private instance variable and property in class extension (Objective-c 2.0)

What are the differences (if any) between the following Objective-c 2.0 code snippets: // in MyClass.h @interface MyClass @private NSString *myString; @end and // in MyClass.m @interface ...
SundayMonday's user avatar
  • 19.4k
5 votes
1 answer
3k views

Why atomic and nonatomic concept has removed from swift

There is no nonatomic keyword in swift, Why nonatomic not required in swift as it exist in objective c.
Mahendra Y's user avatar
  • 1,949
3 votes
5 answers
798 views

Dangers of simultaneous write and read of a boolean in a simple situation

I've read some similar questions but the situations described there are bit more complicated. I have a bool b initialized as false in the heap and two threads. I do understand that operations with ...
Shamdor's user avatar
  • 3,059
2 votes
2 answers
1k views

What is the difference between a strong and weak button in Objective c? [duplicate]

When declaring a button, there are always two options as properties for the button:strong and weak. What is the difference between them? Also, what it nonatomic? For example: @property (weak, ...
Neil Shweky's user avatar
0 votes
2 answers
64 views

Deallocating nonatomic copy setter

I am trying to create non-atomic copy accessors, and I read everywhere that the object should be released at the end. So, if you could help me understand whether I am doing it properly, I would ...
Igor Tupitsyn's user avatar
0 votes
1 answer
586 views

Do I have to use nonatomic property in objective-c ios programing?

I'm developing an iPhone app. All the iPhone development books I have read use nonatomic property. And IBOutlets which xcode generates also use nonatomic keyword. But I don't like to write nonatomic ...
js_'s user avatar
  • 4,701
0 votes
1 answer
798 views

are nonatomic and atomic thread unsafe in objective c?

I read that nonatomic and atomic both are thread unsafe. but nonatomic is faster because it allows faster access means asynchronously and atomic is slower it allows slower access synchronously.
Nitesh's user avatar
  • 1,964
0 votes
0 answers
84 views

C - volatile qualifier while lock is held

Do I need the volatile qualifier for variables only accessed while a lock is held? In this code, could removing the volatile qualifier from n possibly change the behavior when concurrent_foo is ...
Isabell Cowan's user avatar
0 votes
0 answers
21 views

What is the value of property in ios

In Atomic we all know one thread is access one object at a time. if we have 3 thread want to access one object then first come first serve method apply to thread ... but in non atomic all thread is ...
Sachin Kumar's user avatar