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

Add support for acquiring multiple locks at once #958

Merged
merged 3 commits into from
Jun 5, 2018
Merged

Conversation

Adlai-Holler
Copy link
Member

  • New protocol ASLocking which extends NSLocking and adds the -tryLock method.
  • New macros ASSynthesizeLockingMethodsWithMutex and ASSynthesizeLockingMethodsWithObject to remove locking method boilerplate.
  • Make all lockables conform to ASLocking.
  • Add ASDN::Mutex::tryLock().
  • Add ASLockSequence which repeatedly tries to lock different locks in sequence.

No functional changes.

This is a precursor to #956 .

*/
typedef struct {
unsigned count;
CFTypeRef _Nullable locks[32];
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we do any checks against having more locks as 32? it seems if we call ASUnlockSet we could go over 32 to unlock if added more.

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right, done

@TextureGroup TextureGroup deleted a comment Jun 5, 2018
@Adlai-Holler Adlai-Holler merged commit 35d59ac into master Jun 5, 2018
@Adlai-Holler Adlai-Holler deleted the ASLocking branch June 5, 2018 19:31
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

2 participants