You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit guts and reimplements both NSNotificationCenter and NSNotification.
NSNotification is supposed to be a class cluster. It it was empirically observed that non-concrete instances could still encode/decode, but would fail with abstract invocation exceptions on the property getter.
NSNotificationCenter is vastly improved. It:
* Uses sets for quick lookup, since notification order bears no guarantees
* Maintains a set of all receivers (for quick name-free removal)
* Maintains a mapping from notification name to interested receivers (for quick dispatch)
* Now supports enqueuing notification blocks on queues
* Fulfills the contractual obligations of `addObserverForName:object:queue:usingBlock:`
* Has no caveats
* Is thread-safe
* Is tested
Fixes#2391.
NSNotificationCenter is not thread safe, removing, adding and notifying observers from different threads results in a crash.
On the reference platform NSNotificationCenter is thread safe.
The text was updated successfully, but these errors were encountered: