<br><div class="gmail_quote">On Sat, May 29, 2010 at 7:17 PM, Sebastian Trüg <span dir="ltr">&lt;<a href="mailto:trueg@kde.org">trueg@kde.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">On 05/29/2010 03:34 PM, Vishesh Handa wrote:<br>
&gt; On Sat, May 29, 2010 at 5:46 PM, Sebastian Trüg &lt;<a href="mailto:trueg@kde.org">trueg@kde.org</a><br>
</div><div class="im">&gt; &lt;mailto:<a href="mailto:trueg@kde.org">trueg@kde.org</a>&gt;&gt; wrote:<br>
&gt;<br>
</div><div class="im">&gt;     Hehe, this does not help at all. Think about it: in my example there are<br>
&gt;     2 Resource instances involved. Thus: 2 mutexes which are locked<br>
&gt;     independent of each other. :)<br>
&gt;     The mutex is already there in ResourceData. It simply needs to be locked<br>
&gt;     in Resource instead of ResourceData::determineUri.<br>
&gt;<br>
&gt;<br>
&gt; Uhh I&#39;m confused. Why don&#39;t you handle the multi-threading?<br>
<br>
</div>Sure, I can do that. :)<br></blockquote><div><br>Wait! Please don&#39;t. Let me try. I understand it now. (I think)<br> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<div class="im"><br>
&gt; I should really learn about multi-threading. If you have a couple of<br>
&gt; spare minutes could you explain why my method won&#39;t work?<br>
&gt;<br>
&gt; My rationale -<br>
&gt;<br>
&gt; Thread 1 :<br>
&gt; Resource r1(&quot;foo&quot;);<br>
&gt; r1.property( nao:numericRating )<br>
&gt; -&gt; the mutex is locked<br>
&gt; -&gt; performs whatever and determines the uri<br>
&gt;<br>
&gt; Thread 2 :<br>
&gt; Resource r2(&quot;foo&quot;);<br>
&gt; r2.setProperty( whatever )<br>
&gt; -&gt; the mutex can&#39;t get locked so it waits till it does<br>
&gt; -&gt; mutex now locked. Thread 1 should have determined the uri by now<br>
&gt; -&gt; perform operation<br>
<br>
</div>Simple: r1 and r2 have different mutex intances. Thus, locking one does<br>
not prevent the other from being locked. The idea is that both threads<br>
need to lock the same mutex. And that is only possible if the mutex is<br>
stored in ResourceData.<br>
<br></blockquote><div><br>Oh. Of course. Thanks for explanation. :-)<br><br>- Vishesh Handa <br><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

Cheers,<br>
<font color="#888888">Sebastian<br>
</font></blockquote></div><br>