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

ImageMetadataReader.ReadMetadata method does not have an asynchronous version #282

Closed
oliver021 opened this issue Mar 17, 2021 · 1 comment

Comments

@oliver021
Copy link

ImageMetadataReader.ReadMetadata does not have an asynchronous version,
and it would be a very good idea to be able to include it, I in particular can do it
in a very easy way without the simplistic Task.Run method. I tell you,
is that I am using this library in asynchronous context and I cannot give myself
the luxury of blocking the thread with synchronous call, then I had to practically
invent a synchronous method that could perfectly be part of this great
library.

@oliver021 oliver021 changed the title mageMetadataReader.ReadMetadata method does not have an asynchronous version ImageMetadataReader.ReadMetadata method does not have an asynchronous version Mar 17, 2021
@drewnoakes
Copy link
Owner

Hi @oliver021, thanks for your suggestion.

We are tracking async support in #256.

Let's differentiate between

  • blocking your current thread, and
  • blocking any thread.

The first is a problem when the thread has many responsibilities tied to it, such as the UI thread does.

The second is a problem in highly concurrent environments.

Pushing the work to the thread pool (e.g. using Task.Run) solves the first problem, but not the second.

Solving the second problem requires using async IO when reading data, on the assumption that the bulk of the time spent waiting for extraction to complete comes from IO (which is likely often the case). Supporting this is a large undertaking, as it requires the library to wire async/await all the way through its various APIs. async/await also comes with some overhead, which would need to be measured before we commit to changing any APIs.

I'll close this so we don't fork the discussion. Please subscribe to the other issue for updates.

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

No branches or pull requests

2 participants