Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • All good advice (I've read several of the articles you linked before), but I feel like this is more of generic guidelines of when to use async, and less about the specific situation. The interface implementation(s) are like plugins for interfacing with different hardware, and no, I don't know enough about the dozens of vendor specific libraries to know how "true" their async is. Are you suggesting that there be twice as many functions, for both asyc and not, and that the developer should know enough about the individual devices to use them differently? That's what I was trying to avoid. Commented Apr 3, 2020 at 22:22
  • @cost I have updated my answer. But you seem to imply that you need a common interface, implementations of which may or may not be asynchronous, is that right? Commented Apr 3, 2020 at 22:29
  • Yes, I need/want a common interface so the developer can just call TurnLightOn and not worry about any other details. I'll update my question too. Some, but not all of the internal implementations, use libraries that have async calls to return if it was a success or not. Because of that, I have to have Task/await all the way up so that the returned bool can be passed up. Other libraries just return a bool. Commented Apr 3, 2020 at 22:33
  • About your most recent edit with the link, that was one place I found that makes that recommendation. I haven't been able to find too much dialogue about it though, which is why I was looking for extra thoughts here. Thanks for your input! Commented Apr 3, 2020 at 22:40
  • I have updated my answer again. Yes, based on your requirements, I think your proposed design is the most advantageous at the moment. Maybe we can wait to see what others have to propose. Commented Apr 3, 2020 at 22:40