-
Notifications
You must be signed in to change notification settings - Fork 74
Open
Description
I understand the dispatchOnQueue method allows a subscriber to specify the thread on which to run its callback code.
However, I need to fire events from code which is running on a background thread. As it happens, all subscribers to these events are in the main thread. It feels like using dispatchOnQueue in this case would require the subscribers to know about the origin of the event, leading to tightly-coupled code.
So I assume the obvious solution is to fire the events on the main thread in the first place:
// Send a signal on the main thread.
DispatchQueue.main.async {
self.onRawStderrorReceived.fire(stringData)
}Does this approach sound correct? The reason I am asking is that I keep getting Thread 1: EXC_BAD_ACCESS (code=1, address=0xfffffffffffffff0) errors thrown at that point (Xcode actually highlights the comment, oddly).
Metadata
Metadata
Assignees
Labels
No labels