Einzelnen Beitrag anzeigen

Benutzerbild von DP News-Robot
DP News-Robot

Registriert seit: 4. Jun 2010
14.979 Beiträge
 
#1

Data-driven Multithreading

  Alt 13. Feb 2018, 22:40
About a week ago, Craig Chapman posted a vlog Lockless Multi-Threading in Delphi where he programmed a lockless communication channel which transfers messages between the main thread and a worker thread (or, actually, between any two threads).

I do like Craig's implementation of a lockless queue. It is small, neat, and working. I also like that he approached multithreading from a communication viewpoint. I do, however, have several issues with how it is integrated into the application. While I whole understand the need for simple demo that viewers can understand, I feel that the Delphi world is full of such examples. That makes it hard for a newcomer to the multithreaded world to find appropriate patterns to copy.

Hence I decided to rewrite Craig's code with different objectives in mind. Instead of speed I focused on flexibility, ease of use and good multithreaded programming patterns. Before I jump into my solution, however, I must articulate the bad programming practices in the Lockless*demo. (That is strictly subjective reasoning. Your mileage may vary. It is, alas, a reasoning supported by many many years of writing bad multithreaded code - and not yet enough years of writing good code.)

Read more »[SIZE=-2]--- Published under the Creative Commons Attribution 3.0 license[/SIZE]


Weiterlesen...
  Mit Zitat antworten Zitat