June 2003
Intermediate to advanced
800 pages
34h 20m
English
You need a dedicated thread that will process queue tasks and process them continuously.
Create a threaded class that stores tasks in a queue and monitors the queue continuously.
A common pattern in distributed application design is a task processor: a dedicated thread that performs requested tasks on a first-in-first-out basis. This thread lives for the life of the application and uses an internal collection (typically a queue) to store requested tasks until it has a chance to process them.
Creating a task processor is fairly easy. However, to do it properly, you need to leverage the stop request pattern and thread wrapper pattern shown in recipes Stop a Thread Politely and Create a Thread ...
Read now
Unlock full access