Wednesday, December 30, 2009

A gift to all multithreaded Delphi programmers

A (very) prerelease version 1.05, available via SVN or as a ZIP archive.

I’ve managed to produce two interesting data structures:

  • TOmniQueue (existing class TOmniQueue was renamed to TOmniBoundedQueue) is a dynamically allocated, O(1) enqueue and dequeue, threadsafe,  microlocking queue. The emphasys is on dynamically allocated. In other words – it grows and shrinks!
  • TOmniBlockingCollection is a partial clone (with some enhancements) of .NET’s BlockingCollection.

Have fun and happy new year to all Delphi programmers!

Labels: , , , ,

4 Comments:

Blogger greener said...

Interesting.
I have read your article about Threads in Blaizepascal.
Interesting and looking forward to read the next installment.
Chris

05:00  
OpenID mghie said...

The blocking collection looks incredibly useful, but how can I use it in the context of thread shutdown? Imagine a few consumers blocking on the collection inside Take(), and then the consumer threads are to be shut down. How could this be achieved?

16:16  
OpenID mghie said...

OK, after reading the source code I think CompleteAdding() is doing the trick. Neat. Thanks for that present.

16:26  
Blogger gabr said...

Yes, CompleteAdding and wait for consumers to shut down.

18:03  

Post a Comment

Links to this post:

Create a Link

<< Home