[Gtk-sharp-list] PATCH: speed up treeview and managed values

Ben Maurer bmaurer@users.sourceforge.net
Mon, 16 Feb 2004 11:49:09 -0500


Hello Paolo,

Thank you, as always, for your feedback.

On Mon, 2004-02-16 at 07:03, Paolo Molaro wrote:
> On 02/15/04 Ben Maurer wrote:
> > 	HASH_INSERT_INT (ref_table, handle, HASH_LOOKUP_INT (ref_table, handle) + 1);
> This is completely thread-unsafe (the original code is, too, but the
> race window is much smaller). Refcounts should be handled from C# code
> (using Interlocked.Increment() etc).
Yep, it is absolutely thread unsafe. However, because an unref on a
GValue could cause an unref on a GUI object, it must be done from the
GUI thread. Thus, this operation may *only* be done from one thread.

> As for the boxing overhead: it's probably possible to avoid it or we
> might want to wait and fix it when generics is implemented.

Am wondering how you suggest we avoid it. I mean, we could do our own
hashtable impl, but ick, I would rather write a few lines of C. And
given that we not only have to wait for Mono's generics but also for MS
to release theirs and for it to become widely used enough that people
upgrade, that may be quite a long wait.

-- Ben