<br><div class="gmail_quote">On Sat, May 29, 2010 at 7:17 PM, Sebastian Trüg <span dir="ltr"><<a href="mailto:trueg@kde.org">trueg@kde.org</a>></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>
> On Sat, May 29, 2010 at 5:46 PM, Sebastian Trüg <<a href="mailto:trueg@kde.org">trueg@kde.org</a><br>
</div><div class="im">> <mailto:<a href="mailto:trueg@kde.org">trueg@kde.org</a>>> wrote:<br>
><br>
</div><div class="im">> Hehe, this does not help at all. Think about it: in my example there are<br>
> 2 Resource instances involved. Thus: 2 mutexes which are locked<br>
> independent of each other. :)<br>
> The mutex is already there in ResourceData. It simply needs to be locked<br>
> in Resource instead of ResourceData::determineUri.<br>
><br>
><br>
> Uhh I'm confused. Why don't you handle the multi-threading?<br>
<br>
</div>Sure, I can do that. :)<br></blockquote><div><br>Wait! Please don'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>
> I should really learn about multi-threading. If you have a couple of<br>
> spare minutes could you explain why my method won't work?<br>
><br>
> My rationale -<br>
><br>
> Thread 1 :<br>
> Resource r1("foo");<br>
> r1.property( nao:numericRating )<br>
> -> the mutex is locked<br>
> -> performs whatever and determines the uri<br>
><br>
> Thread 2 :<br>
> Resource r2("foo");<br>
> r2.setProperty( whatever )<br>
> -> the mutex can't get locked so it waits till it does<br>
> -> mutex now locked. Thread 1 should have determined the uri by now<br>
> -> 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>