Hi,
I using boost::bind() to create thread. But, I got errors at:
threadGroup.create_thread(boost::bind(&lab1::Server::Run, server));
Any help is really appreciated.
Code is as follows: ---------------------------------------------
class Server {public: // The constructor takes a port number and prepares to receive HTTP // requests from clients on that port. explicit Server(int port);
// Closes the connection. ~Server();
// void Run(); //Server(Server&);private: // 'listening' socket used to establish HTTP connections int listen_fd_;
// Non-copyable, non-assignable Server(Server&); Server& operator=(Server&);};
int main(int argc, char *argv[]) { if (argc != 2) { std::cout << "Usage: lab1 <port>" << std::endl; return 1; }
// Convert the port from a string to an integer. int port_number; std::istringstream port_stream(argv[1]); // argv[1] is port number, port_stream >> port_number;
// Convert the thread number from a string to an integer. int thread_number; std::istringstream thread_stream(argv[2]); // argv[1] is port number, thread_stream >> thread_number; lab1::Server server(port_number);
boost::thread_group threadGroup;
for(int i=0;i