|
Boost : |
From: Reich, Shalom (Shalom.Reich_at_[hidden])
Date: 2001-06-22 09:07:54
> From: williamkempf_at_[hidden] [mailto:williamkempf_at_[hidden]]
> > But it is also not unknown to create a fixed size pool of Thread
> > objects, and then start them later on demand.
>
> I'm curious as to why. This just doesn't seem like the best solution
> to any problem.
>
Eliminate the overhead of thread creation and destruction. The usual
approach is to start the threads in the pool and pass the "Command"
objects. The thread then invokes the run() or execute() on the Command.
IIRC this was described in the Active Object pattern (which talks about
the Command in this context).
This is often used in things like Web servers.
Shalom Reich
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk