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

Async functions are not supported #41

Open
arg0d opened this issue Oct 19, 2023 · 4 comments
Open

Async functions are not supported #41

arg0d opened this issue Oct 19, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@arg0d
Copy link
Collaborator

arg0d commented Oct 19, 2023

I have tried to implement async functions for 0.24, but ran into some issues.

  1. The performance is inadequate. Trying to await 1000 functions that only sleep for 100ms and return, takes around 1 second. This equates to around 1ms per async function call. I'm completely dumbfounded why this happens. I don't have time right now to try and profile this.

  2. Returning objects from functions is not working in some cases. The C# marshaller complains that SafeHandle cannot be marshalled. This happens when future callback is being invoked. A solution could be to rework the code to use IntPtr instead of SafeHandle.

With uniffi 0.25 just around the corner, it seems like async functions have had a significant rework. I'm hoping that the changes in 0.25 might automatically solve at least one of these issues. As this is not a priority for us right now, I'm postponing async functions for later.

@meenzen
Copy link
Contributor

meenzen commented Nov 23, 2023

Any news now that this tool uses uniffi 0.25?

I've noticed that uniffi-bindgen-cs currently generates invalid stubs for async methods, making it impossible to use for existing codebases with uniffi annotations.

@arg0d
Copy link
Collaborator Author

arg0d commented Nov 23, 2023

Async function are not a priority for us, so I haven't had the time to look into this. Though generating invalid code in presence of async is not acceptable and I missed this somehow. A PR would be welcome, it shouldn't be difficult to generate "empty" or no return stubs that throw an exception when called 😉

@vynxc
Copy link

vynxc commented Oct 5, 2024

Can I expect to see any developments on this? Need async and external types.

@arg0d
Copy link
Collaborator Author

arg0d commented Oct 7, 2024

I have no plans to work on this in the near future.

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

No branches or pull requests

3 participants