Re: GTimeoutSources



Tristan Van Berkom wrote:
Hi all,
        I'm going to end up having to write some enhancement to
the g_timeout_* api for my app, so I thought I'd consult the pro's ;-)
maybe that way I could send the patches upstream.

    So I wrote up a GTimeoutPool based on the g_timeout_* layout
which I will be using for my applications, I added an attatchement to:
    http://bugzilla.gnome.org/show_bug.cgi?id=143061

in short, it does:
/**************************************************************/
typedef gboolean (* GTimeoutPoolFunc) (gint id, gpointer user_data);

GTimeoutPool *g_timeout_pool_new            (gint priority);

gint          g_timeout_pool_add_timeout    (GTimeoutPool *pool,
                                             guint interval,
                                             GTimeoutPoolFunc callback,
                                             gpointer user_data);

void          g_timeout_pool_remove_timeout (GTimeoutPool *pool, gint id);

void          g_timeout_pool_set_interval   (GTimeoutPool *pool,
                                             gint id, guint interval);

void          g_timeout_pool_set_callback   (GTimeoutPool *pool, gint id,
                                             GTimeoutPoolFunc callback);
/**************************************************************/

Ofcourse it uses a sorted list so there should be a significant performance
increase although I haven't run any comparitive tests with large numbers
of timeouts, all I know is that it "works".

If you are interested at all in integrating this into glib you can
let me know and I'll write up some cute gtk-doc stuff, whatever.

Cheers all,
                               -Tristan




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]