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

Paolo Molaro lupus@ximian.com
Mon, 16 Feb 2004 13:03:24 +0100

On 02/15/04 Ben Maurer wrote:
> static gpointer
> increment_ref (gpointer handle)
> {
> 	g_return_val_if_fail (ref_table && free_func, handle);
> 	HASH_INSERT_INT (ref_table, handle, HASH_LOOKUP_INT (ref_table, handle) + 1);
> 	return handle;
> }

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).
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.


lupus@debian.org                                     debian/rules
lupus@ximian.com                             Monkeys do it better