Oh you had not fixed it in your code too...<br>Got it, thanks,<br clear="all">Best regards,<br>Ozgur (Oscar) Ozturk<br><a href="http://www.DrOzgur.com">www.DrOzgur.com</a><br>+1 (614) 805-4370<br> <br><br><div class="gmail_quote">On Sat, Jul 11, 2009 at 6:43 PM, Zachary Turner <span dir="ltr"><<a href="mailto:divisortheory@gmail.com">divisortheory@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> <div class="im">On Sat, Jul 11, 2009 at 5:35 PM, Ozgur Ozturk<<a href="mailto:ozgur7@gmail.com">ozgur7@gmail.com</a>> wrote:<br> > Hi,<br> > ����� Thanks Zachary, yes, I have made a typo, thanks for pointing to it,<br> > and for the explanation.<br> > ����� But it I have the same question for your code since we have a similar<br> > (interleaved) output.<br> > What I understood was, when we call io.run, main thread is suspended until<br> > things assigned to it finishes.<br> > (that is why in the examples the final count is not printed before an<br> > io.run() completes, right?!)<br> > so how come io2.run() is invoked from main thread (before io.run() finishes)<br> > (and we can get interleaved results)?<br> > Something I must be getting wrong.<br> ><br> <br> </div>The typo is what's causing the interleaved results :) �io2 is never<br> being used. �timer2 is attached simply to io. �So you have 2 timers<br> both using the same io_service. �If I change the code so that timer2<br> uses io2, I get the following output:<br> <br> [start]: t1exp: 00:00:00.984375, t2exp: 00:00:01<br> 1: timer1, t1exp: 00:00:02.984375, t2exp: 00:00:01<br> 2: timer1, t1exp: 00:00:01, t2exp: -00:00:01.984375<br> 3: timer1, t1exp: 00:00:01, t2exp: -00:00:02.984375<br> 4: timer1, t1exp: 00:00:01, t2exp: -00:00:03.984375<br> 5: timer1, t1exp: 00:00:01, t2exp: -00:00:04.984375<br> Final count is 5<br> <br> In this case, it will actually call print with timer2 at the very end,<br> but by then count is already 5, so it does not enter the if statement<br> and just returns immediately.<br> <div><div></div><div class="h5">_______________________________________________<br> Boost-users mailing list<br> <a href="mailto:Boost-users@lists.boost.org">Boost-users@lists.boost.org</a><br> <a href="http://lists.boost.org/mailman/listinfo.cgi/boost-users" target="_blank">http://lists.boost.org/mailman/listinfo.cgi/boost-users</a><br> </div></div></blockquote></div><br>