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

[Feature Request]: non-blocking implementation of nativeImage.createThumbnailFromPath() for Windows #31024

Open
3 tasks done
RaisinTen opened this issue Sep 20, 2021 · 5 comments

Comments

@RaisinTen
Copy link
Contributor

Preflight Checklist

Problem Description

nativeImage.createThumbnailFromPath() is implemented in a blocking way for Windows

v8::Local<v8::Promise> NativeImage::CreateThumbnailFromPath(

Proposed Solution

This and all other asynchronous functions should be implemented in a non-blocking way

Alternatives Considered

None

Additional Information

No response

@codebytere
Copy link
Member

@RaisinTen can you elaborate on this?

This and all other asynchronous functions should be implemented in a non-blocking way

Do you mean windows functions? On macOS for example this is non-blocking.

@RaisinTen
Copy link
Contributor Author

Yes @codebytere that is right, for the nativeImage.createThumbnailFromPath() function, I was only talking about the Windows implementation. However, if we find out more such async functions that block the current thread, we should consider dispatching the task to some other thread.

@sebastianrath
Copy link

sebastianrath commented Nov 11, 2021

@RaisinTen Can you elaborate on this? I am planning on using this function. Is this blocking the main thread despite being async?

@RaisinTen
Copy link
Contributor Author

@seb-mtl yes, that's right! When you call this function, it would run the sequence of function calls inside NativeImage::CreateThumbnailFromPath() synchronously, which blocks the current thread. It's only the resolution/rejection of the promise that takes place as a microtask. We need to dispatch these calls to a different thread (in Chromium's thread pool) to make this non-blocking. For reference, I had sent #31023 earlier to create a non-blocking version of a pre-existing function! ;)

@sebastianrath
Copy link

sebastianrath commented Nov 11, 2021

@RaisinTen Thanks for the explanation! You just saved me from hours of debugging.😉

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

No branches or pull requests

3 participants