Subject: Re: [boost] [threadpool] new version - with rescheduling ofcurrenttask
From: k-oli_at_[hidden]
Date: 2009-02-28 06:36:51


Am Saturday 28 February 2009 10:43:10 schrieb vicente.botet:
> If I understand then we will have two function win the same name in
> different namespaces. Does ADL found the good one,i.e. if the user see
> boths overloadings, will wait_for_all(f1, f2) call the the future
> overloading and wait_for_all(t1, t2) calls the task overloading or do we
> need to prefix with the namespace?

I suggest to prefix it - but I could also rename the threadpool specific ones

> Well the question is, what happens if the condition don't retuns true? The
> task doing this will be blocked, but only this task. The worker thread will
> continue to schedule other tasks, of course testing each time this
> condition. It seems to me a good compromise.

This is already provided by the task wait functionality (wait(), get() etc.).
If task::get() or task::wait() would block because the associated future is
not ready the worker thread automatically reschedules, e.g. executes other
items from the pool channel.
I think a explicit reschedule_until() is not required and dangerous.

tp::task< int > t1(
        boost::this_task::get_thread_pool< pool_type >().submit(
                boost::bind(
                        & fibo::par_,
                        boost::ref( * this),
                        n - 1) ) );

t1.get(); // rescheduling if t1.get() would block == until t1.get() would nont
block other items from the pool channel are executed.

regards,
Oliver