Linked Questions
11 questions linked to/from main.async vs main.sync() vs global().async in Swift3 GCD
181
votes
5
answers
169k
views
Difference between DispatchQueue.main.async and DispatchQueue.main.sync
I have been using DispatchQueue.main.async for a long time to perform UI related operations.
Swift provides both DispatchQueue.main.async and DispatchQueue.main.sync, and both are performed on the ...
168
votes
5
answers
66k
views
Are "data races" and "race condition" actually the same thing in context of concurrent programming
I often find these terms being used in context of concurrent programming . Are they the same thing or different ?
124
votes
6
answers
76k
views
Understanding NSRunLoop
Can anyone explain for what is NSRunLoop? so as I know NSRunLoop is a something connected with NSThread right? So assume I create a Thread like
NSThread* th=[[NSThread alloc] initWithTarget:self ...
72
votes
14
answers
170k
views
what does Error "Thread 1:EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)" mean?
I got this error:
Thread 1:EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
How can I solve this? The code works normally, but in the calculator when I click the only equal button, it gives ...
59
votes
7
answers
89k
views
What's the difference between synchronous and asynchronous calls in Objective-C, versus multi-threading?
For the longest time I thought asynchronous was synonymous to running something on a background thread, while synchronous meant on the main thread (blocking UI updates and interactions). I understand ...
70
votes
6
answers
33k
views
iOS/Objective-C equivalent of Android's AsyncTask
I'm familiar with using AsyncTask in Android: create a subclass, call execute on an instance of the subclass and onPostExecute is called on the UI thread or main thread. What's the equivalent in iOS?
23
votes
2
answers
15k
views
Thread safe singleton in swift
I have and Application which has a singleton that stores information across the whole app. However, this is creating some data race issues when using the singleton from different threads.
Here there ...
16
votes
5
answers
6k
views
What does it mean for something to be thread safe in iOS?
I often come across the key terms "thread safe" and wonder what it means. For example, in Firebase or Realm, some objects are considered "Thread Safe". What exactly does it mean for something to be ...
25
votes
1
answer
19k
views
What does main.sync in global().async mean?
In Swift, I used this kind of pattern sometimes.
DispatchQueue.global().async {
// do stuff in background, concurrent thread
DispatchQueue.main.sync {
// update UI
}
}
The ...
3
votes
3
answers
2k
views
GCD Main Thread Crash Issue (Explanation Needed)?
why do this piece of code causes crash ?
DispatchQueue.main.sync {
// Operation To Perform
}
why we have to write this way :-
DispatchQueue.global().async(execute: {
print("test")
...
0
votes
1
answer
642
views
Asynchronous DispatchQueue & Multi Threading in Swift4
Here I've a query about Difference between Threads
Difference Between DispatchQueue.global().sync , DispatchQueue.global().async, DispatchQueue.main.sync and DispatchQueue.main.sync
Here's some ...