ReactiveCocoa/ReactiveCocoa — pull request #1120 by Strilanc (2014-02-19 03:33:10+00:00)
Title: Added a scheduler/synchronized-primitive: RACInOrderScheduler

- Runs scheduled actions in order on an underlying scheduler
- Defaults to immediate underlying scheduler
- Usable as a synchronized primitive
- Faster than @synchronized, without deadlock or re-entrant re-order risks

Can be used to resolve possible deadlocks (see: https://github.com/ReactiveCocoa/ReactiveCocoa/issues/1012 ).

Instead of using @synchronized(_lock), you would use [inOrder schedule:^{ ... }]. In my tests this is twice as fast as @synchronized when on a single thread, and would be almost three times as fast if schedule returned void instead of a nil RACDisposable.