Boost logo

Boost Users :

From: Frank Mori Hess (fmhess_at_[hidden])
Date: 2008-02-10 18:55:16


On Sunday 10 February 2008 09:55, Paul J R wrote:
> class A {
> public:
> A() {}
> ~A() {}
> virtual void worker() {
> std::cout << "I am A worker" << std::endl;
> }
> virtual A *factory() {
> std::cout << "Factory for A class called" << std::endl;
> return new A;
> }
> virtual void operator()() {
> std::cout << "Calling A operator()" << std::endl;
> worker();
> }
> void threadcontroller() {
> boost::thread_group thre;
> for(;;) {
> std::cout << "I am in the A.threadcontroller()
> method" << std::endl;
> A *mea = factory();

I think you might need to call factory like "this->factory()"

> the next 2 are from after the thread_group.create_thread() call. Once
> its in the thread it seems to revert to class A's methods.
>
> Now, i know if i overload the threadcontroller class in B it'd solve all
> my problems, but the real threadcontroller method is alot more complex
> and class A has about 6 sub classes so replicating the threadcontroller
> in each of the classes would be a little tedious.

-- 
Frank



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net