<br><br><div class="gmail_quote">On Jan 10, 2008 8:48 PM, Gennadiy Rozental &lt;<a href="mailto:rogeeff@gmail.com">rogeeff@gmail.com</a>&gt; 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="Ih2E3d">Ovanes Markarian &lt;om_boost &lt;at&gt; <a href="http://keywallet.com" target="_blank">keywallet.com</a>&gt; writes:<br></div><div class="Ih2E3d">&gt; struct thread_safety_test<br>&gt; {<br>&gt; &nbsp; &nbsp; static void thread_function(boost::barrier&amp; b)
<br>&gt; &nbsp; &nbsp; {<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; b.wait();<br><br></div>Can&#39;t comment in these. I never used this class.<br><div class="Ih2E3d"><br>| &nbsp; &nbsp; &nbsp; &nbsp; boost::mutex::scoped_lock lock(m);<br>| &nbsp; &nbsp; &nbsp; &nbsp; BOOST_CHECK_EQUAL(1,0);<br>| &nbsp; &nbsp; }
<br>|<br>| &nbsp; &nbsp; void test_multiple_assertion_faults()<br>| &nbsp; &nbsp; {<br>| &nbsp; &nbsp; &nbsp; &nbsp; boost::thread_group tg;<br>| &nbsp; &nbsp; &nbsp; &nbsp; boost::barrier b(100);<br>|<br>| &nbsp; &nbsp; &nbsp; &nbsp; for(size_t i=0; i&lt;100; ++i)<br>| &nbsp; &nbsp; &nbsp; &nbsp; {<br>| &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tg.create_thread
(boost::bind(thread_function, ref(b)));<br>| &nbsp; &nbsp; &nbsp; &nbsp; }<br>| &nbsp; &nbsp; }<br>| };<br>| But unfortunately this does not work. May be I miss smth. here.<br><br></div>&gt;I am not an expert in MT, but what exactly is the problem?<br>

&gt;<br>&gt;Do you run is from inside the test case?<br><br><br>Yes. The class specified is passed to the <span>BOOST_CLASS_TEST_CASE</span>( multiple_assertion_faults, thread_safety_test)
<br>
<br>
The idea of my code is:<br>
Create 100 threads and wait until all of them are created. (barrier is used for that).<br>
<br>
After all threads were created lock the mutex and produce the assertion
fault. In MSVC 7.1 this code crashes after the second call to
BOOST_CHECK_EQUAL.<br>
<br>
<br>
I thought you would be aware of this issue.<br>
<br>
<br>
Many thanks for your help!<br>
Ovanes<br>
<br>
<div><div class="Wj3C7c"><br></div></div></blockquote></div>