Boss Thread and worker threads communication
Posted on 2009-07-07
Question: Hi. In my main application (main VCL) I want to develop a single boss
A: is able to communicate with worker threads
B: is able to update some VCL componets properties into main VCL basing
on the worker thread results.
C: create the worker thread and limit the number of it using a semaphore
Worker threads are I/O operation. They do some test, create a sort of
array of boolean based on the test performed and store into a shared
buffer (es. TthreadList).
The approach I would like to use is the one of producer/consumer.
So the sequence should be:
- The boss spaws some worker threads
- The workers threads do some test and create a result as [TRUE,FALSE,FALSE...]
with a size that is dynamic.
- the worker thread store it into a shared buffer, protected with Critical Section.
- The boss thread wakes up or wait to access to the buffer. When it does it
will update the propreties in the main VCL
I want to develop this structure without using Syncronize and above all
limiting the buffer size and taking care of flow control between boss an