Sticky: Multi-Threading queue with Borland/CodeGear/Embarcadero RAD 2010

Filed in DevelopmentTags: , , , , , , , , ,

This is a small program to show a way to queuing threads with Rad Studio 2010. I wrote this program to create a queue thread class that I wanted to use in another program (MyNNTP, more on that later).

It’s nothing fancy, and very basic, and yes, there may still be quite a few bugs/improvements I could add to it but for now it works and I haven’t had any crashes with it yet.

Currently the work is based in a vector list, each element will be processed in it’s own thread. Each thread will process 3 Sleep() functions. You can add more work on the fly, and you can add more working threads on the fly too.

When stopping the threads, all threads will stop their cycle and then exit, meaning a thread may only call Sleep() 1 or 2 times, or even 3 if the thread was stopped after the sleep was called in it. The main thing is that the threads will finish off what they are doing and then exit gracefully.

All the vector items need to have a different value, please remember this if changing the code, as this is what is used to find them in the queue to either remove, add or stop.

Multi-Threading queue

Exe

http://www.arden.ie/wp-content/plugins/downloads-manager/img/icons/winrar.gif Download: Multi-Threading Queue Application (376.01KB)
Added: 20/11/2009
Description: Multi-Threading Queue Application

Src

http://www.arden.ie/wp-content/plugins/downloads-manager/img/icons/winrar.gif Download: Multi-Threading Queue Source Code (8.00KB)
Added: 20/11/2009
Description: Multi-Threading Queue Source Code

Leave a Reply