c++ - How to create a boost thread with data? -


I'm going through some issues with promotion: creating binds and threads.

Basically, using the I band, would like to call a "scan" function on the "scanner" object.

Something like this:

  scanner scanner; Int id_to_scan = 1; Promotion: thread thr1 (boost :: bind (and scanner :: scan));  

However, I slide into syntax. How do I scan data? As part of the manufacturer?

Keep in mind that the first logic of any member function is an object.

If you want to call:

  scanner * s; S- & gt; Scan ()  

You can use it with the bind:

  boost :: bind (& scanner :: scan, s);  

If you want to make a call:

  s-> Scans (42);  

Use this:

  boost :: bind (and scanner :: scan, s, 42);  

Since I often want to bind objects that make bind objects, I often do this:

  boost :: bind (& scanner): : Scan, it);  

Good luck.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -