Friday, December 30, 2011

OmniThreadLibrary 3.0

As promised, I’m releasing OmniThreadLibrary with 64-bit support today!

Get it now: ZIP, SVN, UML diagrams (provided by Rich Shealer).

If you’ll be using it in production, wait until Tuesday as I won’t be fixing any bugs over the weekend and on the Monday there is a public holiday here in Slovenia.

New features

  • Support for 64-bit platform. Great thanks to [GJ] for doing most of the work!
  • Implemented background worker abstraction, Parallel.BackgroundWorker.
  • Implemented Atomic<T> class for lock-free initialization of interfaces and objects.
    Implemented Locked<T> class for locking initialization of practically anything. [read more, more, more and more]
  • TOmniValue.AsInteger, AsString and AsWideString now work if the TOmniValue contains a Variant of the apropriate type.
  • TOmniValue can store arrays, hashes and records. [read more]
  • Added a class which can wrap any record - TOmniRecordWrapper<T>.
  • Added an interface which can wrap any object and destroy it when the interface goes out of scope - IOmniAutoDestroyObject.

Bug fixes

  • Fixed bugs in TOmniInterfaceDictionary which caused scheduled tasks not to be destroyed until the program was terminated. Great thanks to [Zarko] for providing a reproducible test case.
  • Fixed race condition between TOmniTask.Execute and TOmniTask.Terminate.
  • Under some circumstances ProcessMessage failed to rebuild handle array before waiting which could cause 'invalid handle' error.
  • Fixed wrong order in teardown sequence in TOmniTask.Execute which could cause access violation crash. Great thanks to [Anton Alisov] for providing a reproducible test case.
  • Fixed invalid "A call to an OS function failed" error in DispatchEvent.
  • TOmniMessageQueue.Enqueue leaked if queue was full and value contained reference counted value (found by [meishier]).
  • Number of producers/consumers in TOmniForkJoin<T>.StartWorkerTasks was off by 1 (found by [meishier]).

New demos

  • 49_FramedWorkers: Multiple frames communication with each own worker task.
  • 50_OmniValueArray: Wrapping arrays, hashes and records in TOmniValue.
  • 51_PipelineStressTest: Stress test by [Anton Alisov].
  • 52_BackgrondWorker: Demo for the new Parallel.BackgroundWorker abstraction.


  1. Rico12:13

    Congratulations to this new major release!
    I wish your family and you all the best for the new year.

  2. Leslie11:41

    I keep coming back to check on the progress of OTL. It is a very-very promising project. I did some simple tests earlier for the win32 platform, but what I am really hoping for is IOS and Android support. We need a single codebase for the none visual parts of the projects for all platforms. I know 64bit support is just out and it is probalby rest time now, but if there are any plans about other plaforms for OTL I would be glad to read about them. :)

  3. Soon to come: FireMonkey support.
    Next: OS/X support.
    Not in the near future: iOS support.

    The problem with iOS (besides that I have no idea if it supports multithreading at all) is that OTL uses many language features that are not supported in FreePascal, which is used to compile Delphi iOS applications.

  4. Leslie12:44

    I doubt there is any OS still being developed without threading. IOS defenetely depends on it.

    I clearly did not think my question through. The incompatibilities of freepascal are obviously a showstopper. Once the Delphi IOS compiler will be ready porting will hopefully be much less work.