I would be grateful for any advice on the best solution for the following telecommunications problem;
At run-time, work queues will be created dynamically (in fact 1 per call). In order to ensure that each item in the work queue is fully processed before processing of the next item begins, only 1 thread can act on a work queue at any time. Possible solutions;
A) Create a new thread per call at runtime. Disadvantage: Inefficient as there is a large thread creation overhead.
B) Create a pool of threads at system startup. When a new work queue is created, remove the thread from the pool and dedicate it to the work queue. When the work queue is destroyed, return the thread to the thread pool. Disadvantage: Requires 1 thread per call, thread will only be busy for brief periods
C) Create a pool of threads at system startup. The pool will monitor a list of work queues but ensure that only 1 thread acts on any work queue at any time.
Does anyone have any other solutions or tips on how to implement solutions B or preferably C?
Thanks in advance.