Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B Bolts-ObjC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 34
    • Issues 34
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 7
    • Merge requests 7
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • BoltsFramework
  • Bolts-ObjC
  • Merge requests
  • !253

Replace @synchronized with NSRecursiveLock

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/rgurzhiy/master into master May 24, 2016
  • Overview 1
  • Commits 3
  • Pipelines 0
  • Changes 3

Created by: rgurzhiy

This pull request replaces @synchronized with NSRecursiveLock as in #249 we've discovered that @synchronized holds unretained allocations. The replacement is pretty much straightforward. I've just changed

@synchronized (self.lock) {
...
}

with

[self.lock lock];
...
[self.lock unlock];

and removed all returns in between.

There are still 2 places I'm not sure about: BFTask

- (void)waitUntilFinished {
    if ([NSThread isMainThread]) {
        [self warnOperationOnMainThread];
    }

    [self.lock lock];
    if (self.completed) {
        [self.lock unlock];
        return;
    }
    [self.condition lock];
    [self.lock unlock];
...

BFCancellationTokenRegistration

- (void)dispose {
    [self.lock lock];
    if (self.disposed) {
        [self.lock unlock];
        return;
    }
    self.disposed = YES;
    [self.lock unlock];
...
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/rgurzhiy/master