Kitware / Remus

Remus is a remote mesh/model service framework.
Other
9 stars 9 forks source link

Boost asio worker factory #25

Open robertmaynard opened 10 years ago

robertmaynard commented 10 years ago

Create a derived WorkerFactory, that uses the boost thread and asio to create a pool of threads and assign them to workers.

We will need to have an api that allows users to easily register workers for the pool to use. The key is that the pool will want to have a single server connection it passes to the users bound function.

So we need something like:

template<typename WorkerLauncer>
bool registerWorkerType( const remus::proto::JobRequirements& requirements, 
                                          WorkerLauncer wl);

where WorkerLauncher is a bound function with the following signature


bool launchWorker( const remus::proto::JobRequirements& requirements, 
                                 const remus::worker:: ServerConnection& conn);
robertmaynard commented 9 years ago

PR #198 Shows how to make a boost worker pool, while it doesn't allow registering of custom worker types, it would be fairly easy to add. So instead of having a QtWorkerPollFactory example, lets make it a boost ThreadPoolWorkerFactory.

robertmaynard commented 9 years ago

http://stackoverflow.com/questions/12215395/thread-pool-using-boost-asio