Closed oliver021 closed 3 years ago
Hi @oliver021, thanks for your suggestion.
We are tracking async support in https://github.com/drewnoakes/metadata-extractor-dotnet/issues/256.
Let's differentiate between
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.
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.