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

Improve AtomicWrite performance with pthread_mutex and os_unfair_lock #8

Closed
wants to merge 1 commit into from

Conversation

yvbeek
Copy link

@yvbeek yvbeek commented Jul 3, 2019

Use os_unfair_lock if it is available, otherwise fall back to pthread_mutex.

This should give a nice performance boost according to the tests in this article:
https://www.cocoawithlove.com/blog/2016/06/02/threads-and-mutexes.html

@yvbeek
Copy link
Author

yvbeek commented Jul 3, 2019

Why is the wrapper called AtomicWrite instead of Atomic?
The documentation was referring to Atomic

I hope that I implemented the locks correctly 🙂

We should probably demonstrate that this is actually faster than DispatchQueue and that it doesn't leak or cause any threading issues.

This pull request was closed.
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

Successfully merging this pull request may close these issues.

None yet

1 participant