From: Douglas Gregor (gregod_at_[hidden])
Date: 2002-07-16 07:19:53
On Tuesday 16 July 2002 03:20 am, Niall Kelly wrote:
> I then wanted to clean this up and allow a
> boost::thread_pool reference to be somehow associated
> with the asynchronous wrappers. An asynchronous
> wrapper function object instance is created by the
> signals implementation (and its operator() is invoked)
> for each slot. I do not have access to the
> asynchronous wrapper instances in my code so I can't
> pass a thread_pool& to a constructor or similar....
> Can you suggest an elegant mechanism by which to
> associate a thread_pool with the asynchronous wrapper?
> Thanks again,
Here are two options:
1) Construct the asynchronous wrappers explicitly, as in:
tp.add(make_asynchronous(boost::bind(f_, t1), the_thread_pool));
2) Use another wrapper that is recognized by the asynchronous wrappers,
tp.add(in_thread_pool(the_thread_pool, boost::bind(f_, t1)));
in_thread_pool will return some simple wrapper around the thread pool and
the function object. Then the asyncronous wrapper can recognize this class
and extract the thread pool and function object directly.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk