Boost logo

Boost Users :

Subject: [Boost-users] Boost thread: class member problem
From: Patricia Hazel Shaw [phs] (phs_at_[hidden])
Date: 2011-01-27 05:47:39


Dear List members,

I am trying to make use of threads within a class, but seem to be having problems with the syntax and getting it to compile. The outline of my class related to this thread issue is as follows:

class Board{
public:
        void pressButton(int button);
        void boxAction(int box);
private:
        boost::thread_group threads;
};

void Board::pressButton(int button){
        if(button=1){
                threads.create_thread(&boxAction,1);
        } else ...
}

I have tried various different syntax within the create_thread() but have not been able to figure out from the documentation, or reading through the history of this mailing list, how to correctly do this. Any help you could give me would be greatly appreciated.

Patricia Shaw


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