Hello guys

Hello guys,

Once Delphi already has a Task-based parallel library (PPL) starting from XE7, would be very good whether async method overload were added.
TStream class for example, Read and Write method could have their async overloads returning Task or Future objects :D
Edit: It only makes sense with Task Continuation support :D It think it will come in next major release.

o/

Comments

  1. Please, no more methods tacked onto poor TStream. Haven't you seen the poor critter? It's suffocating already!

    ReplyDelete
  2. Also, does the PPL spin up new threads if one task bloks for a long time? If not, then you can end up in a situation where no CPU-bound tasks gets executed because a bunch of I/O tasks are blocking.

    ReplyDelete
  3. And to be serious, it is not a good idea to put these methods in TStream, because it's not a given that the underlying TStream implementation can handle being run in a different thread, or is thread-safe in general.

    It is also trivial to make an AsyncStream wrapper where you give it a TStream and it provides async read/write methods.

    ReplyDelete
  4. Asbjørn Heid Should we decide to add Async/overlapped I/O methods to TStream, the global threadpool wouldn't likely be used... or the threadpool would allow for segregation of I/O threads from general purpose threads. So, yes, your fear about a lot of I/O swamping the threadpool is well founded and has established precedent.

    ReplyDelete
  5. Oliver Münzberg I quite liked using Boost.IOStreams, but not sure if it's transferrable to Delphi.

    ReplyDelete

Post a Comment