Skip to content

Commit

Permalink
Merge pull request #147 from github/subscriber-threading
Browse files Browse the repository at this point in the history
Fix RACSubscriber, RACReplaySubject thread safety; remove RACAsyncSubject
  • Loading branch information
joshaber committed Nov 29, 2012
2 parents 13b1fa0 + baadde1 commit bb2c55a
Show file tree
Hide file tree
Showing 18 changed files with 630 additions and 399 deletions.
2 changes: 1 addition & 1 deletion GHAPIDemo/GHAPIDemo/GHGitHubClient.m
Expand Up @@ -90,7 +90,7 @@ - (RACSignal *)postPublicKey:(NSString *)key title:(NSString *)title {
}

- (RACSignal *)enqueueRequestWithMethod:(NSString *)method path:(NSString *)path parameters:(NSDictionary *)parameters {
RACAsyncSubject *subject = [RACAsyncSubject subject];
RACReplaySubject *subject = [RACReplaySubject subject];
NSURLRequest *request = [self requestWithMethod:method path:path parameters:parameters];
AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:^(AFHTTPRequestOperation *operation, id responseObject) {
[subject sendNext:responseObject];
Expand Down
2 changes: 1 addition & 1 deletion RACExtensions/NSData+RACSupport.m
Expand Up @@ -13,7 +13,7 @@ @implementation NSData (RACSupport)
+ (RACSignal *)rac_readContentsOfURL:(NSURL *)URL options:(NSDataReadingOptions)options scheduler:(RACScheduler *)scheduler {
NSParameterAssert(scheduler != nil);

RACAsyncSubject *subject = [RACAsyncSubject subject];
RACReplaySubject *subject = [RACReplaySubject subject];

[scheduler schedule:^{
NSError *error = nil;
Expand Down
2 changes: 1 addition & 1 deletion RACExtensions/NSString+RACSupport.m
Expand Up @@ -13,7 +13,7 @@ @implementation NSString (RACSupport)
+ (RACSignal *)rac_readContentsOfURL:(NSURL *)URL usedEncoding:(NSStringEncoding *)encoding scheduler:(RACScheduler *)scheduler {
NSParameterAssert(scheduler != nil);

RACAsyncSubject *subject = [RACAsyncSubject subject];
RACReplaySubject *subject = [RACReplaySubject subject];

[scheduler schedule:^{
NSError *error = nil;
Expand Down
2 changes: 1 addition & 1 deletion RACExtensions/NSTask+RACSupport.m
Expand Up @@ -55,7 +55,7 @@ - (RACCancelableSignal *)rac_run {
- (RACCancelableSignal *)rac_runWithScheduler:(RACScheduler *)scheduler {
NSParameterAssert(scheduler != nil);

RACAsyncSubject *subject = [RACAsyncSubject subject];
RACReplaySubject *subject = [RACReplaySubject subject];

__block BOOL canceled = NO;
[[RACScheduler mainQueueScheduler] schedule:^{
Expand Down
28 changes: 13 additions & 15 deletions ReactiveCocoaFramework/ReactiveCocoa.xcodeproj/project.pbxproj
Expand Up @@ -84,8 +84,6 @@
88CDF7E715000FCF00163A9F /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 88CDF7E515000FCF00163A9F /* InfoPlist.strings */; };
88D4AB3E1510F6C30011494F /* RACReplaySubject.h in Headers */ = {isa = PBXBuildFile; fileRef = 88D4AB3C1510F6C30011494F /* RACReplaySubject.h */; settings = {ATTRIBUTES = (Public, ); }; };
88D4AB3F1510F6C30011494F /* RACReplaySubject.m in Sources */ = {isa = PBXBuildFile; fileRef = 88D4AB3D1510F6C30011494F /* RACReplaySubject.m */; };
88D4AB491510F8F10011494F /* RACAsyncSubject.h in Headers */ = {isa = PBXBuildFile; fileRef = 88D4AB471510F8F10011494F /* RACAsyncSubject.h */; settings = {ATTRIBUTES = (Public, ); }; };
88D4AB4A1510F8F10011494F /* RACAsyncSubject.m in Sources */ = {isa = PBXBuildFile; fileRef = 88D4AB481510F8F10011494F /* RACAsyncSubject.m */; };
88DA309815071CBA00C19D0F /* RACValueTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 88DA309615071CBA00C19D0F /* RACValueTransformer.m */; };
88E2C6B4153C771C00C7493C /* RACScheduler.h in Headers */ = {isa = PBXBuildFile; fileRef = 88E2C6B2153C771C00C7493C /* RACScheduler.h */; settings = {ATTRIBUTES = (Public, ); }; };
88E2C6B5153C771C00C7493C /* RACScheduler.m in Sources */ = {isa = PBXBuildFile; fileRef = 88E2C6B3153C771C00C7493C /* RACScheduler.m */; };
Expand All @@ -99,7 +97,6 @@
88F440BF153DAD600097B4C3 /* RACConnectableSignal.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F5870115361BCD0084BD32 /* RACConnectableSignal.m */; };
88F440C0153DAD630097B4C3 /* RACSubject.m in Sources */ = {isa = PBXBuildFile; fileRef = 880B9175150B09190008488E /* RACSubject.m */; };
88F440C1153DAD640097B4C3 /* RACReplaySubject.m in Sources */ = {isa = PBXBuildFile; fileRef = 88D4AB3D1510F6C30011494F /* RACReplaySubject.m */; };
88F440C2153DAD660097B4C3 /* RACAsyncSubject.m in Sources */ = {isa = PBXBuildFile; fileRef = 88D4AB481510F8F10011494F /* RACAsyncSubject.m */; };
88F440C3153DAD690097B4C3 /* RACBehaviorSubject.m in Sources */ = {isa = PBXBuildFile; fileRef = 883A84D91513964B006DB4C7 /* RACBehaviorSubject.m */; };
88F440C4153DAD6A0097B4C3 /* RACMaybe.m in Sources */ = {isa = PBXBuildFile; fileRef = 8820370915096A4F002428D3 /* RACMaybe.m */; };
88F440C5153DAD6C0097B4C3 /* RACDisposable.m in Sources */ = {isa = PBXBuildFile; fileRef = 883A84DE1513B5EC006DB4C7 /* RACDisposable.m */; };
Expand Down Expand Up @@ -137,7 +134,6 @@
90AF46D71625537D0054F8A0 /* RACCancelableSignal+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 88A5F4FD156B3FED009E49DC /* RACCancelableSignal+Private.h */; };
90AF46D81625537D0054F8A0 /* RACSubject.h in Headers */ = {isa = PBXBuildFile; fileRef = 880B9174150B09190008488E /* RACSubject.h */; };
90AF46D91625537D0054F8A0 /* RACReplaySubject.h in Headers */ = {isa = PBXBuildFile; fileRef = 88D4AB3C1510F6C30011494F /* RACReplaySubject.h */; };
90AF46DA1625537D0054F8A0 /* RACAsyncSubject.h in Headers */ = {isa = PBXBuildFile; fileRef = 88D4AB471510F8F10011494F /* RACAsyncSubject.h */; };
90AF46DB1625537D0054F8A0 /* RACBehaviorSubject.h in Headers */ = {isa = PBXBuildFile; fileRef = 883A84D81513964B006DB4C7 /* RACBehaviorSubject.h */; };
90AF46DC1625537D0054F8A0 /* RACDisposable.h in Headers */ = {isa = PBXBuildFile; fileRef = 883A84DD1513B5EC006DB4C7 /* RACDisposable.h */; };
90AF46DD1625537D0054F8A0 /* RACScopedDisposable.h in Headers */ = {isa = PBXBuildFile; fileRef = 884476E2152367D100958F44 /* RACScopedDisposable.h */; };
Expand Down Expand Up @@ -179,6 +175,8 @@
D05C5C9F16490C4900DE6D3E /* NSNotificationCenter+RACSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 88442C8C16090C1500636B49 /* NSNotificationCenter+RACSupport.m */; };
D05C5CA016490C4D00DE6D3E /* NSString+RACSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 88442C8E16090C1500636B49 /* NSString+RACSupport.m */; };
D05C5CA116490C5200DE6D3E /* NSTask+RACSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 88442C9016090C1500636B49 /* NSTask+RACSupport.m */; };
D0C70EC616659333005AAD03 /* RACSubscriberExamples.m in Sources */ = {isa = PBXBuildFile; fileRef = D0C70EC516659333005AAD03 /* RACSubscriberExamples.m */; };
D0C70EC8166595AD005AAD03 /* RACSubscriberSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = D0C70EC7166595AD005AAD03 /* RACSubscriberSpec.m */; };
D0C70F90164337A2007027B4 /* RACSequenceAdditionsSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = D0C70F8F164337A2007027B4 /* RACSequenceAdditionsSpec.m */; };
D0C70F93164337E3007027B4 /* RACSequenceExamples.m in Sources */ = {isa = PBXBuildFile; fileRef = D0C70F92164337E3007027B4 /* RACSequenceExamples.m */; };
D0D487011642550100DD7605 /* RACStream.h in Headers */ = {isa = PBXBuildFile; fileRef = D0D486FF1642550100DD7605 /* RACStream.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand Down Expand Up @@ -420,8 +418,6 @@
88CDF82C15008C0500163A9F /* NSObject+RACPropertySubscribing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = "NSObject+RACPropertySubscribing.h"; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
88D4AB3C1510F6C30011494F /* RACReplaySubject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RACReplaySubject.h; sourceTree = "<group>"; };
88D4AB3D1510F6C30011494F /* RACReplaySubject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = RACReplaySubject.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
88D4AB471510F8F10011494F /* RACAsyncSubject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RACAsyncSubject.h; sourceTree = "<group>"; };
88D4AB481510F8F10011494F /* RACAsyncSubject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = RACAsyncSubject.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
88DA309515071CBA00C19D0F /* RACValueTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RACValueTransformer.h; sourceTree = "<group>"; };
88DA309615071CBA00C19D0F /* RACValueTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RACValueTransformer.m; sourceTree = "<group>"; };
88DA30D31508051F00C19D0F /* RACSpecs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RACSpecs.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -476,6 +472,9 @@
D095BDCE15CB2E4B00E9BB13 /* Mac-Framework.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Mac-Framework.xcconfig"; sourceTree = "<group>"; };
D095BDCF15CB2E4B00E9BB13 /* Mac-StaticLibrary.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Mac-StaticLibrary.xcconfig"; sourceTree = "<group>"; };
D095BDD015CB2E4B00E9BB13 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = text; path = README.md; sourceTree = "<group>"; };
D0C70EC416659333005AAD03 /* RACSubscriberExamples.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RACSubscriberExamples.h; sourceTree = "<group>"; };
D0C70EC516659333005AAD03 /* RACSubscriberExamples.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RACSubscriberExamples.m; sourceTree = "<group>"; };
D0C70EC7166595AD005AAD03 /* RACSubscriberSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RACSubscriberSpec.m; sourceTree = "<group>"; };
D0C70F8F164337A2007027B4 /* RACSequenceAdditionsSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RACSequenceAdditionsSpec.m; sourceTree = "<group>"; };
D0C70F91164337E3007027B4 /* RACSequenceExamples.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RACSequenceExamples.h; sourceTree = "<group>"; };
D0C70F92164337E3007027B4 /* RACSequenceExamples.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RACSequenceExamples.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -733,6 +732,9 @@
D0487AB1164314430085D890 /* RACStreamExamples.h */,
D0487AB2164314430085D890 /* RACStreamExamples.m */,
889D0A7F15974B2A00F833E3 /* RACSubjectSpec.m */,
D0C70EC416659333005AAD03 /* RACSubscriberExamples.h */,
D0C70EC516659333005AAD03 /* RACSubscriberExamples.m */,
D0C70EC7166595AD005AAD03 /* RACSubscriberSpec.m */,
8820937B1501C8A600796685 /* RACSignalSpec.m */,
88FC735A16114FFB00F8A774 /* RACSubscriptingAssignmentTrampolineSpec.m */,
88442A321608A9AD00636B49 /* RACTestObject.h */,
Expand Down Expand Up @@ -779,7 +781,7 @@
887ACDA6165878A7009190AD /* NSInvocation+RACTypeParsing.m */,
D0D486FF1642550100DD7605 /* RACStream.h */,
D0D487001642550100DD7605 /* RACStream.m */,
D0D486FB164253B600DD7605 /* Subscribables */,
D0D486FB164253B600DD7605 /* Signals */,
D0D486FD164253D500DD7605 /* Disposables */,
D0D486FE164253E100DD7605 /* Commands */,
D0E967561641EF8200FCFF06 /* Sequences */,
Expand Down Expand Up @@ -903,7 +905,7 @@
path = "Mac OS X";
sourceTree = "<group>";
};
D0D486FB164253B600DD7605 /* Subscribables */ = {
D0D486FB164253B600DD7605 /* Signals */ = {
isa = PBXGroup;
children = (
88CDF80415001CA800163A9F /* RACSignal.h */,
Expand All @@ -921,7 +923,7 @@
88A5F4FA156B3FCB009E49DC /* RACCancelableSignal.m */,
D0D486FC164253C400DD7605 /* Subjects */,
);
name = Subscribables;
name = Signals;
sourceTree = "<group>";
};
D0D486FC164253C400DD7605 /* Subjects */ = {
Expand All @@ -931,8 +933,6 @@
880B9175150B09190008488E /* RACSubject.m */,
88D4AB3C1510F6C30011494F /* RACReplaySubject.h */,
88D4AB3D1510F6C30011494F /* RACReplaySubject.m */,
88D4AB471510F8F10011494F /* RACAsyncSubject.h */,
88D4AB481510F8F10011494F /* RACAsyncSubject.m */,
883A84D81513964B006DB4C7 /* RACBehaviorSubject.h */,
883A84D91513964B006DB4C7 /* RACBehaviorSubject.m */,
);
Expand Down Expand Up @@ -999,7 +999,6 @@
88A5F4FB156B3FCB009E49DC /* RACCancelableSignal.h in Headers */,
88037FC41505646C001A5B19 /* RACAsyncCommand.h in Headers */,
88D4AB3E1510F6C30011494F /* RACReplaySubject.h in Headers */,
88D4AB491510F8F10011494F /* RACAsyncSubject.h in Headers */,
883A84DA1513964B006DB4C7 /* RACBehaviorSubject.h in Headers */,
883A84DF1513B5EC006DB4C7 /* RACDisposable.h in Headers */,
886F702A1551CF920045D68B /* RACGroupedSignal.h in Headers */,
Expand Down Expand Up @@ -1065,7 +1064,6 @@
90AF46D71625537D0054F8A0 /* RACCancelableSignal+Private.h in Headers */,
90AF46D81625537D0054F8A0 /* RACSubject.h in Headers */,
90AF46D91625537D0054F8A0 /* RACReplaySubject.h in Headers */,
90AF46DA1625537D0054F8A0 /* RACAsyncSubject.h in Headers */,
90AF46DB1625537D0054F8A0 /* RACBehaviorSubject.h in Headers */,
90AF46DC1625537D0054F8A0 /* RACDisposable.h in Headers */,
90AF46DD1625537D0054F8A0 /* RACScopedDisposable.h in Headers */,
Expand Down Expand Up @@ -1298,7 +1296,6 @@
8820370B15096A4F002428D3 /* RACMaybe.m in Sources */,
880B9177150B09190008488E /* RACSubject.m in Sources */,
88D4AB3F1510F6C30011494F /* RACReplaySubject.m in Sources */,
88D4AB4A1510F8F10011494F /* RACAsyncSubject.m in Sources */,
88977C3E1512914A00A09EC5 /* RACSignal.m in Sources */,
883A84DB1513964B006DB4C7 /* RACBehaviorSubject.m in Sources */,
883A84E01513B5EC006DB4C7 /* RACDisposable.m in Sources */,
Expand Down Expand Up @@ -1368,6 +1365,8 @@
D05C5C9F16490C4900DE6D3E /* NSNotificationCenter+RACSupport.m in Sources */,
D05C5CA016490C4D00DE6D3E /* NSString+RACSupport.m in Sources */,
D05C5CA116490C5200DE6D3E /* NSTask+RACSupport.m in Sources */,
D0C70EC616659333005AAD03 /* RACSubscriberExamples.m in Sources */,
D0C70EC8166595AD005AAD03 /* RACSubscriberSpec.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -1388,7 +1387,6 @@
88F440C1153DAD640097B4C3 /* RACReplaySubject.m in Sources */,
88F440C0153DAD630097B4C3 /* RACSubject.m in Sources */,
88F440C6153DAD6E0097B4C3 /* RACScopedDisposable.m in Sources */,
88F440C2153DAD660097B4C3 /* RACAsyncSubject.m in Sources */,
88A5F4FE156B4301009E49DC /* RACCancelableSignal.m in Sources */,
88F440C3153DAD690097B4C3 /* RACBehaviorSubject.m in Sources */,
88F440CD153DAD820097B4C3 /* NSObject+RACBindings.m in Sources */,
Expand Down
21 changes: 0 additions & 21 deletions ReactiveCocoaFramework/ReactiveCocoa/RACAsyncSubject.h

This file was deleted.

74 changes: 0 additions & 74 deletions ReactiveCocoaFramework/ReactiveCocoa/RACAsyncSubject.m

This file was deleted.

0 comments on commit bb2c55a

Please sign in to comment.