In this video, I demonstrate a technique for communicating between threads in a Delphi application, without using typical locking mechanisms such as critical sections. Best Viewed in Full Screen (Recorded 1080p).

Download the source

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder. Design. Code. Compile. Deploy.

Start Free Trial   Free Delphi Community Edition   Free C++Builder Community Edition   Upgrade Today  

No Data
  • Hi, The problem is that its still not threadsafe. If one thread is pushing while the other is pulling then there is a race condition between updating and comparing the index counters. At least you should use InterlockedIncrement and when you reach a border and need to reset the index, you would need to use a waitloop and InterlockedCompareAndExchange which in itself introduce a finegrained lock. best regards Kim/C4D
No Data