Skip to content

Conversation

AArnott
Copy link
Member

@AArnott AArnott commented Aug 10, 2023

This adds a more convenient way to execute async code while holding (or waiting for) a mutex.

Mutexes are traditionally very difficult to asynchronously wait for or do async work while holding because they are thread affinitized. This new class creates a dedicated thread to 'own' the mutex while allowing the AsyncMutex owner to await for the mutex and run async code on any thread while holding it.

@AArnott AArnott added this to the v17.8 milestone Aug 10, 2023
@AArnott
Copy link
Member Author

AArnott commented Aug 10, 2023

The linux failure is when the net472 build of the library is executed on the mono runtime. I've been dropping support for mono lately and maybe it's time to drop it from this library as well. But I'm trying a couple things to see if I can get it to work for the new code first.

@AArnott AArnott force-pushed the asyncMutex branch 3 times, most recently from ce704ab to e4a619c Compare August 14, 2023 23:40
Copy link
Member

@lifengl lifengl left a comment

Choose a reason for hiding this comment

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

looks good to me if this is intended for a narrow usage scenario. It is somewhat different from the Mutex, so I am not sure whether using a generic name like an async version of the original class is a good idea, as it may confuse some users.

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

Successfully merging this pull request may close these issues.

3 participants