<div dir="ltr">Hello all .<br>i am a newbie to the boost community . i recently started learning about threads in boost . now there are some questions i would like to ask :<br>1.where can i find examples showing practical uses of boost::thread features? <br>

2.how can i get all threads ID issued by me in my app? <br>
3.how can i iterate through running threads in my app ? <br>
<a href="http://4.is">4.is</a> there any kind of means to get all the running threads using boost 
library? if it does whats the calss? if it doesnt how can i do that?<br>
5.can i resume a thread after pausing it ? ( how can i pause a thread? )<br>6. how can i share a variable between two or more threads , suppose i have a loop , i want two threads to simultaneously iterate through it , if thread1 counted to 3, thread2 continues it from 4 and so on . ?<br>

i already tried  <br>------<br><blockquote style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">what is wrong with my sample app ? <br>#include &lt;iostream&gt;<br>
#include &lt;boost/thread.hpp&gt;<br>
using namespace std;<br>using namespace boost;<br><br>mutex bmutex;<br>int i=0;<br>int sum=0;<br>void IteratorFunc(int threadid)<br>{<br>             for (  ; i&lt;25 ; i++)<br>            {<br>                    lock_guard&lt;mutex&gt; locker(bmutex);<br>

                     cout&lt;&lt;&quot;\t&quot;&lt;&lt;threadid&lt;&lt;&quot;\t&quot;&lt;&lt;this_thread::get_id()&lt;&lt;&quot;\t&quot;&lt;&lt;i&lt;&lt;&quot;\n&quot;;<br>                      sum+=i;<br>            }<br>

}<br><br>int main()<br>{<br>    //boost::posix_time::ptime start = boost::posix_time::microsec_clock::local_time();<br><br>    thread thrd(IteratorFunc,1);<br>    thread thrd2(IteratorFunc,2);<br>   <br>    cout&lt;&lt;sum;<br>

    thrd.join();<br>    thrd2.join();<br>}<br></blockquote>Thank you in advance<br></div>

