Monday, October 17, 2016

OmniThreadLibrary 3.06

Hi, guys! After a looong time, a new version of OmniThreadLibrary was released! It is available as a zipped download, git checkout, via Delphinus and (really soon) via GetIt.

Following stuff was added/changed/fixed since the 3.05 release:

Breaking changes

  • Type TWaitFor.TWaitResult renamed to TWaitFor.TWaitForResult.
  • Packages were renamed. Now they are using $LIBSUFFIX scheme. This will also solve problems with GetIt if you are installing OTL in more than one Delphi release.

New features

  • Implemented Parallel.For<T>(const arr: TArray<T>).
  • New abstraction Parallel.TimedTask.
  • Added types TOmniAlignedInt32 and TOmniAlignedInt32 which replaced TGp4AlignedInt and TGp8AlignedInt64.
  • Added NUMA support
    • Implemented Environment.ProcessorGroups and Environment.NUMANode to provide information about processors in a massively parallel systems. (Windows only, simulated on other platforms.)
    • Implemented IOmniTaskControl.ProcessorGroup and .NUMANode.
    • Implemented IOmniTask.SetProcessorGroup and .SetNUMANode.
    • Implemented IOmniThreadPool.ProcessorGroups, .NUMANodes.
  • Implemented IOmniThreadPool.Affinity.
  • In the past, unhandled exceptions in the code handling the task execution were lost. Now, they are passed up to the IOmniThreadPool. If its property Asy_OnUnhandledWorkerException is set, exception will be passed to the event handler and application should react to it. The only safe way at that point is to log the error (and stack trace for the current thread) and terminate the application.
  • TOmniThreadPool.Create no longer waits on thread to be initialized. This allows a thread pool to be created inside DLL initialization code.
  • Implemented TOmniRecord<T>, a simple way to wrap "anything" in a record.
  • Added thread pool lifecycle notifications to OtlHooks (RegisterPoolNotification, UnregisterPoolNotification).


  • [HHasenack] Added more unit tests.

Bug fixes

  • Fixed unsafe 64-bit pointer-to-integer casts in TOmniCS.Initialize and Atomic<T>.Initialize.
  • Fixed processing of 'new message'/'new wake event' events in TWaitFor.
  • [HHasenack] Fixed memory leak in handling 'owned objects' in TOmniValue.
  • IOmniAffinity.Mask changed from DWORD to NativeUInt to correctly support up to 64 processors on 64-bit systems.
  • Fixed memory leaks when iterating over interface types with Parallel.For.


  1. Great thanks! BTW, where (on which systems) NUMA support is needed? I thought at the present time distributed processing on different machines (BOINC etc) is used more often than specialized multi-processor systems.

    1. There are some users out there with 80 and more cores in one machine ...