ume05rw / EzSmb

SMB(Windows shared folder) Clinet Library powered by TalAloni's SmbLibrary, Xamarin & .NET Core Ready.
GNU Lesser General Public License v3.0
53 stars 20 forks source link

Any reason for the async API? #10

Open natalie-o-perret opened 3 years ago

natalie-o-perret commented 3 years ago

Hi,

Is there any reason for the the async API when it just tosses the job on the default scheduler?

I mean it doesn't saved any thread while it could based on the inherent IO latency.

ume05rw commented 3 years ago

It's simple, I want to run queries in parallel. Anyway, pull requests are welcome!

natalie-o-perret commented 3 years ago

I mean this can be a bit misleading, considering that in most libraries users usually expect Async versions of methods to help you to save up some threads by leveraging the inherent latency of IO / network.

If would be better to provide synchronous vers and let the users decide whether they want things in parallel or not. Wdyt?

Afaik, Task.Run is usually for consumer code, not libraries.

ume05rw commented 3 years ago

save up some threads by leveraging the inherent latency of IO / network.

Is there an implementation somewhere I can refer to?

natalie-o-perret commented 3 years ago

save up some threads by leveraging the inherent latency of IO / network.

Is there an implementation somewhere I can refer to?

https://blog.stephencleary.com/2013/11/there-is-no-thread.html

Will try to find a ref. implementation for you (when my schedule will allow it).