Monday, January 28, 2013

The OTL Book–Russian Edition

Just a quick notice to my readers – the Russian translation of Parallel Programming with OmniThreadLibrary has been updated and now contains all the material from the English edition.

Big thanks go to Alex Egorov for his hard work!

image

Saturday, January 26, 2013

Žarko is back!

Add this link to your RSS reader: http://zarko-gajic.iz.hr/feed/

Monday, January 21, 2013

Sending Event Handlers Across Thread Boundary

Recently, I ran into an interesting problem. I was doing some high-bandwidth, low-latency data processing where a background task received the data, dispatched it to a central hub which then forwarded data to the appropriate data processing & transmitting thread. Data absolutely had to travel through the main thread (the reasons for that are quite convoluted and not important for the story) which bothered me from a performance viewpoint. This could introduce some unwanted overhead as I can only send data to the main thread via Windows messages.

The simplest (given the current codebase) way to solve the problem was to introduce an asynchronous event handler. The main thread implements an event handler called for each received data block and passes this event handler to the receiver thread, which calls the event handler from its own context. As a result, the code that logically belongs to the main thread is executed from the worker thread and there is (almost) no delayed introduced. (The ‘almost’ part coming from the fact that I had to use some locking to synchronize operations inside the main thread.)

During the implementation phase, I found out that it’s quite difficult to send an event handler over the OmniThreadLibrary communication channel. The solution was non-trivial and required quite some ugly hacks so I’m posting it here for future reference.

Friday, January 18, 2013

DataSnap Speed & Stability, Part 2

As the Roberto’s blog is still not listed on the DelphiFeeds, I’d like to bring your attention to his second article about DataSnap: DataSnap analysis based on Speed & Stability tests – Part 2.