Passing argument to boost thread with boost bind

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Dec 2008
Posts: 30
Reputation: codedhands is an unknown quantity at this point 
Solved Threads: 0
codedhands codedhands is offline Offline
Light Poster

Passing argument to boost thread with boost bind

 
0
  #1
Jul 17th, 2009
Hi,i am having problems passing arguments to a boost thread.I have tried using the boost::bind,it works without argument but when i try to pass arguments,it doesn't work.Here are my codes:

  1. class Parser
  2. {
  3. void Start(int a)
  4. {
  5. ...
  6. }
  7.  
  8. void makeThread(int id)
  9. {
  10. boost::thread pThread(boost::bind(&Parser::Start,id)); //Problem here
  11. boost::thread::yield();
  12. pThread.join();
  13. }
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC