Skip to content

Commit

Permalink
Make state setter/getter thread-safe (thanks @Cocoanetics).
Browse files Browse the repository at this point in the history
  • Loading branch information
samvermette committed Jun 30, 2012
1 parent 31ec15b commit 27b7127
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions SVHTTPRequest/SVHTTPRequest.m
Expand Up @@ -322,6 +322,20 @@ - (BOOL)isExecuting {
return self.state == SVHTTPRequestStateExecuting;
}

- (SVHTTPRequestState)state {
@synchronized(self) {
return state;
}
}

- (void)setState:(SVHTTPRequestState)newState {
@synchronized(self) {
[self willChangeValueForKey:@"state"];
state = newState;
[self didChangeValueForKey:@"state"];
}
}

#pragma mark -
#pragma mark Delegate Methods

Expand Down

0 comments on commit 27b7127

Please sign in to comment.