943,832 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 2809
  • C++ RSS
Jul 17th, 2009
0

Passing argument to boost thread with boost bind

Expand Post »
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:

C++ Syntax (Toggle Plain Text)
  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. }
Reputation Points: 10
Solved Threads: 0
Light Poster
codedhands is offline Offline
30 posts
since Dec 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Symlink Windows?
Next Thread in C++ Forum Timeline: test score with pointer notation





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC