Comments (9)
deferredScheduler
uses dispatch_get_current_queue
so it probably shouldn't be used except for logging or testing purposes in the first place.
from reactivecocoa.
I think the lesson of this and #94 is that RACScheduler
needs to become a lot more capable.
from reactivecocoa.
This also implies calling send
on a RACSubject
from different threads isn't safe if some of it's subscriptions are done indirectly through the non-threadsafe <RACSignal>
methods.
I've always used RAC very conservative thread-wise, so I haven't looked into it much, but it seems to me the documentation doesn't make it very clear what is and what is not thread-safe.
from reactivecocoa.
@Coneko That's a good point, but we can solve it by serializing RACSubject
message delivery in the same way we're discussing for RACScheduler
.
I definitely don't think <RACSignal>
and <RACStream>
methods should need explicit synchronization. They should be able to treat the stream serially.
from reactivecocoa.
[Is] #136 also covered by #138? It doesn't matter if a scheduler delivers concurrently if the subscriber which is the receiver of the delivery takes care of serializing the deliveries.
I want to say that this can be closed once #138 is implemented, but I'm worried there's something I'm overlooking. I'll think about it a bit more.
from reactivecocoa.
Based on how I've fixed RACSubscriber
's thread safety in #147, this might still be valuable. That implementation merely applies an arbitrary order to incoming concurrent messages βΒ there's no real concept of thread FIFO.
For example:
RACSubject *subject = [RACSubject subject];
[RACScheduler.backgroundScheduler schedule:^{
[subject sendNext:@0];
}];
[RACScheduler.backgroundScheduler schedule:^{
[subject sendNext:@1];
}];
[RACScheduler.backgroundScheduler schedule:^{
[subject sendNext:@2];
}];
Would you expect 0, 1, and 2 to arrive in that order? There's no guarantee that's how it'll happen right now, because each scheduled block is asynchronous on a concurrent queue, and context switching could cause a later send to complete before an earlier one.
Now, whether this is actually an issue in practice, I still don't know.
from reactivecocoa.
It makes sense to document this behavior in RACScheduler
and let the user decide whether they'd rather have a serializing scheduler to ensure values are received in the same order they're sent in or a parallel scheduler to process values as fast as possible.
from reactivecocoa.
π Fair point.
from reactivecocoa.
As part of this, it'd also be nice to add a couple things to RACScheduler
to solidify a serial vs. concurrent distinction:
// Whether this scheduler is concurrent.
@property (nonatomic, readonly, getter = isConcurrent) BOOL concurrent;
// Returns a serial RACScheduler that schedules its blocks on the receiver.
- (instancetype)asSerialScheduler;
from reactivecocoa.
Related Issues (20)
- [SwiftPM on Xcode] Package resolution failed HOT 2
- Unable to compile targeting macOS Catalyst using SwiftPM (fix exists)
- why RACObserve(self.scoreStepper,value) not available? HOT 1
- App rejected for HealthKit metadata HOT 4
- UISearchBar delegate proxy crash on Mac Catalyst HOT 1
- Build error when using ReactiveCocoa via Swift Package Manager HOT 3
- can not deinit HOT 2
- Xcode12 ReactiveObj archive error HOT 3
- How to implement PIN input with attempts HOT 1
- Dispose SignalProducer created via Action HOT 1
- UnsafeKVOProperty initializer crashes after updating to ReactiveSwift 6.5.0 HOT 1
- EXC_BAD_ACCESS Cash with NSURL HOT 1
- ReactiveCocoa 11.1.0 incompatible with ReactiveSwift 6.6.0 HOT 5
- Xcode 12.5 beta 3 can't build ReactiveCocoa with SwiftPM. HOT 2
- Using "<~" binding function with Signal.Observers causes memory leaks. HOT 1
- Upgrading from very old version (2.5) fails - can't find ReactiveCocoa.h HOT 1
- Cannot remove an observer <RACKVOProxy 0x280264940> for the key path "unit" from <HGConfigureModel 0x280d25050> because it is not registered as an observer.
- Current version can't be compiled with the latest ReactiveSwift version HOT 2
- Current version can't be compiled with the latest ReactiveSwift version HOT 6
- Add output values support for interception
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reactivecocoa.