<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Oct 25, 2013 at 10:31 AM, Alexandre Julliard <span dir="ltr"><<a href="mailto:julliard@winehq.org" target="_blank" onclick="window.open('https://mail.google.com/mail/?view=cm&tf=1&to=julliard@winehq.org&cc=&bcc=&su=&body=','_blank');return false;">julliard@winehq.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">George Stephanos <<a href="mailto:gaf.stephanos@gmail.com" onclick="window.open('https://mail.google.com/mail/?view=cm&tf=1&to=gaf.stephanos@gmail.com&cc=&bcc=&su=&body=','_blank');return false;">gaf.stephanos@gmail.com</a>> writes:<br>

<br>
> � � You need some sort of free list instead of a linear search.<br>
><br>
> Alright.<br>
><br>
> � � Also you can probably avoid one level of pointers and store<br>
> � � objects directly.<br>
><br>
><br>
> I thought about this. If I store objects directly, accessing any would<br>
> require a lock on the whole table so I guarantee it's not moved or<br>
> reallocated elsewhere. This would obviously be pretty slow.<br>
<br>
</div>You already have a lock on the whole table anyway.<br></blockquote><div><br></div><div>I do. But it's only used when creating new handles or on table reallocations.</div><div>Earlier I could reallocate the table without worrying about the handles.</div>
<div><br></div><div>In your case that same lock would have to be grabbed when�</div><div>*accessing* any of the handles so I make sure the table is�</div><div>not being reallocated.</div><div>That results in: no two handles can be accessed concurrently as opposed�</div>
<div>to my current code where they can.</div><div>I might be missing something though :|</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
> � � Returning a pointer to the object outside of the critical section<br>
> � � is not<br>
> � � a good idea.<br>
><br>
> The critical section just protects the table and not the<br>
> handles/structs themselves.<br>
<br>
</div>Yes, that's the problem. The structs have to be protected too.<br></blockquote><div><br></div><div>Maybe a lock inside each struct?</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<span class="HOEnZb"><font color="#888888"><br>
--<br>
Alexandre Julliard<br>
<a href="mailto:julliard@winehq.org" onclick="window.open('https://mail.google.com/mail/?view=cm&tf=1&to=julliard@winehq.org&cc=&bcc=&su=&body=','_blank');return false;">julliard@winehq.org</a><br>

</font></span></blockquote></div><br></div></div>