mail-archives/gtk-sharp-list/2004-February/003395.html

75 строки
2.8 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Gtk-sharp-list] PATCH: speed up treeview and managed values
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:lupus%40ximian.com">
<META NAME="robots" CONTENT="index,nofollow">
<LINK REL="Previous" HREF="003382.html">
<LINK REL="Next" HREF="003396.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Gtk-sharp-list] PATCH: speed up treeview and managed values
</H1>
<B>Paolo Molaro
</B>
<A HREF="mailto:lupus%40ximian.com"
TITLE="[Gtk-sharp-list] PATCH: speed up treeview and managed values">lupus@ximian.com
</A><BR>
<I>Mon, 16 Feb 2004 13:03:24 +0100</I>
<P><UL>
<LI> Previous message: <A HREF="003382.html">[Gtk-sharp-list] PATCH: speed up treeview and managed values
</A></li>
<LI> Next message: <A HREF="003396.html">[Gtk-sharp-list] PATCH: speed up treeview and managed values
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#3395">[ date ]</a>
<a href="thread.html#3395">[ thread ]</a>
<a href="subject.html#3395">[ subject ]</a>
<a href="author.html#3395">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>On 02/15/04 Ben Maurer wrote:
&gt;<i> static gpointer
</I>&gt;<i> increment_ref (gpointer handle)
</I>&gt;<i> {
</I>&gt;<i> g_return_val_if_fail (ref_table &amp;&amp; free_func, handle);
</I>&gt;<i> HASH_INSERT_INT (ref_table, handle, HASH_LOOKUP_INT (ref_table, handle) + 1);
</I>&gt;<i> return handle;
</I>&gt;<i> }
</I>
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
--
-----------------------------------------------------------------
<A HREF="mailto:lupus@debian.org">lupus@debian.org</A> debian/rules
<A HREF="mailto:lupus@ximian.com">lupus@ximian.com</A> Monkeys do it better
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI> Previous message: <A HREF="003382.html">[Gtk-sharp-list] PATCH: speed up treeview and managed values
</A></li>
<LI> Next message: <A HREF="003396.html">[Gtk-sharp-list] PATCH: speed up treeview and managed values
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#3395">[ date ]</a>
<a href="thread.html#3395">[ thread ]</a>
<a href="subject.html#3395">[ subject ]</a>
<a href="author.html#3395">[ author ]</a>
</LI>
</UL>
</body></html>