Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YYThreadSafeDictionary iOS 14.5 死锁问题 #582

Open
ganvinalix opened this issue Feb 3, 2021 · 0 comments
Open

YYThreadSafeDictionary iOS 14.5 死锁问题 #582

ganvinalix opened this issue Feb 3, 2021 · 0 comments

Comments

@ganvinalix
Copy link

ganvinalix commented Feb 3, 2021

  1. 写Plist文件

[self.localNewPromptDic writeToFile:pListPath atomically:YES];

1.系统调用,此时申请了lock

- (void)enumerateKeysAndObjectsWithOptions:(NSEnumerationOptions)opts usingBlock:(void (^)(id key, id obj, BOOL *stop))block {
    LOCK([_dic enumerateKeysAndObjectsWithOptions:opts usingBlock:block]);
}
  1. enumerateKeysAndObjectsWithOptions iOS 14.5 会调用 hash 以前系统不会,再次申请所了卡死
- (NSUInteger)hash {
    LOCK(NSUInteger hash = [_dic hash]);
    return hash;
}

建议:LOCK 改为递归锁?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant