Only three months since 2.1 and a new release is already here? What’s going on?
I had to change some things to make OTL work in XE2 and although I could simply release new files as a patch I noticed that I’ve also done quite some work on exception handling and that I could equally well wrap everything in a new release.
There were some breaking changes since the 2.1 release so let’s start with those …
- Parallel.Join reimplemented as IOmniParallelJoin interface to add exception and cancellation support. User code must call .Execute on the interface returned from the Parallel.Join to
start the execution. [read more]
- Parallel.Join(const task: TOmniTaskDelegate) is no longer supported. It was replaced with the Parallel.Join(const task: IOmniJoinState).
- Parallel.Join no longer supports taskConfig parameter (replaced by the IOmniParallelJoin.TaskConfig function).
- Two versions of Parallel.Async (the ones with explicit termination handlers) were removed as this functionality can be achieved by using Parallel.TaskConfig.OnTerminated. [read more]
- Delphi XE2 support (Windows 32-bit only).
- Parallel.Task can be used to execute multiple copies of a common code. [read more]
- Added exception handling to Parallel.Join. Tasks' fatal exceptions are wrapped in EJoinException and raised at the end of Parallel.Join method (or when WaitFor is called if Join is executed with the .NoWait modifier). [read more]
- Number of simultaneously executed task in Parallel.Join may be set by calling the new IOmniParallelJoin.NumTasks function.
- Added exception handling to IOmniFuture<T>. Tasks' fatal exception is raised in .Value. New function .FatalException and .DetachException. [read more]
- Implemented TOmni[Base]Queue.IsEmpty. Keep in mind that the returned value may not be valid for any amount of time if other threads are reading from/writing to the queue.
- Implemented another IOmniTaskControl.OnTerminated overload accepting parameterless anonymous function.
- Implemented [I|T]OmniBlockingCollection.IsFinalized.
- Parallel.Pipeline accepts 'simple stage' (for loop implemented internally). [read more]
- TOmniValue can natively store exception objects (AsException, IsException).
- Implemented IOmniBlockingCollection.ReraiseExceptions. If enabled (default: disabled), [Try]Take will check if returned value for exception (TOmniValue.IsException) and if true, it will reraise this exception instead of returning a result.
- Assertions are enabled in OTLOptions.inc - OtlContainers needs them.
- Event monitor in connection to the thread pool was totally broken. (Big thanks to [anton alisov] for finding the problem.)
- Fixed [Try]Add/CompleteAdding/[Try]Take three-thread race condition in TOmniBlockingCollection. [read more]
- 48_OtlParallelExceptions: Exception handling in high-level OTL constructs.