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

Always use error checking pthread mutex. #654

Merged
merged 4 commits into from
Jul 10, 2018
Merged

Always use error checking pthread mutex. #654

merged 4 commits into from
Jul 10, 2018

Conversation

andersio
Copy link
Member

@andersio andersio commented Jul 3, 2018

Resolves #652 and ReactiveCocoa/ReactiveCocoa#3598.

Make all Lock.PthreadLock be backed by error checking mutexes. Mitigate #508 in a different way.

Checklist

  • Updated CHANGELOG.md.

@@ -187,6 +181,15 @@ internal class Lock {
case EBUSY:
return false
default:
#if DEBUG && arch(arm)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like EAGAIN will be silently allowed when DEBUG, but will lead to an assertion failure when !DEBUG.

I wonder if it should be the other way around? I usually set DEBUG in builds where I want more assertions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess at this point we should just treat EAGAIN as EBUSY. Just found this issue: ReactiveCocoa/ReactiveCocoa#3598.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The weirdest thing is that based on the libpthread implementation only the recursive lock can return EAGAIN, and it holds for implementations since El Capitan GM. All the reported issues do not seem to involve properties which are the only thing using recursive locks in ReactiveSwift.

@andersio
Copy link
Member Author

andersio commented Jul 4, 2018

Just found out that on Darwin 11 was EDEADLK and 35 was EAGAIN, i.e. swapped wrt the Linux counterparts. Although it still doesn't make any sense. 🤦‍♂️

@mdiep mdiep merged commit 8190c33 into master Jul 10, 2018
@mdiep mdiep deleted the anders/locks branch July 10, 2018 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants