Friday, December 10, 2010

Out with the old … in with the two

OmniThreadLibrary 1.05 was a great success …


… but all good things must come to an end. Don’t worry, I’m not ending the project. It’s just that there’s a new player in town. Ladies and gentlemen, in the left corner I give you …


… OmniThreadLibrary 2.0! Get it while its hot!

The big change is improved high-level parallelism support (sorry, D2007 folks, this works only in D2009 and up). Now you can enjoy using parallel for loops, futures and pipelines (click on the links for more info).

Other improvements are smaller but numerous. Read the whole list below.

Enjoy the new OmniThreadLibrary and remember – I love reading.Winking smile

What’s new in version two

  • New high-level primitives (unit OtlParallel):
    • Improved parallel for (Parallel.ForEach).
    • Futures (Parallel.Future<T>).
    • Pipelines (Parallel.Pipeline).
  • Added support for multiple simultaneous timers. SetTimer takes additional 'timerID' parameter. The old SetTimer assumes timerID = 0.
  • IOmniTask/IOmniTaskControl
    • ParamByName has been removed, use .Param[name: string].
    • Param returns TOmniValueContainter.
  • IOmniTaskControl.OnMessage also accepts an object (message dispatcher; form, for example).
  • TOmniValueContainer
    • IndexOfName renamed to TOmniValueContainer.IndexOf.
    • New methods in TOmniValueContainer class: ByName, Count, Exists. New properties:
      • Items[integer]
      • Items[string]
      • Items[TOmniValue]
  • TOmniValue
    • Fixed memory leak when sending String, WideString, Variant and Extended values over the communication channel and when queueing them into TOmni[Base]Queue.
    • Implemented _AddRef, _Release, _ReleaseAndClear.
    • TOmniValue can be cast as Int64.
    • Implemented conversions to/from TValue (Delphi 2010 and newer).
    • Implemented constructor.
    • [scarre] Added TDateTime support.
  • New classes and interfaces
    • TOmniMessageQueueTee
    • IOmniCommDispatchingObserver
    • TOmniCounter, auto-initialized wrapper around the IOmniCounter
    • TOmniMessageID record, used internally to implement timers
  • OmniThreadPool: ThreadDataFactory can now accept either a function or a method.
  • TOmniEventMonitor: Message retrieving loop destroys interface immediately, not when the next message is received.
  • TOmniTaskFunction renamed to TOmniTaskDelegate.
  • Added function CreateResourceCount(initialCount): IOmniResourceCount.
  • Renamed IOmniCancellationToken.IsSignaled -> IsSignalled.
  • .dproj tests renamed to .2007.dproj.
  • Added Delphi XE project files.
  • Bugs fixed
    • Thread pool was immediately closing unused threads if MaxExecuting was set to -1.
    • Ugly bugs in TOmniBlockingCollection removed.
  • New demos
    • 38_OrderedFor: Ordered parallel for loops.
    • 39_Future: Futures.
    • 40_Mandelbrot: Parallel graphics demo (very simple).
    • 41_Pipeline: Pipelines.
    • 42_MessageQueue: Stress tests for TOmniMessageQueue.


  1. Very nice thanks for your hard work!

  2. Anonymous21:31

    So great! thank you for such a nice library.

  3. Thanks for your work Primoz!

  4. Chee Meng09:19

    Woohoo! Thanks Primoz, and congrats on the release! :)

  5. Anonymous15:06

    Hi Primoz!

    Congratulations and thank you, great work.

    Keep going.

  6. Cristiano Narcisi18:48

    Thanks Primoz, very good job... WOW great Christmas gift! :-))

  7. ahwux19:06


  8. Anonymous15:10

    thank you for this awesome library, i'll use it in my project ;)

  9. Anonymous16:59

    Wowie Zowie!

    Great work, Primoz


  10. Anonymous12:05

    super cool, great work!