Re: Threads and updating.
- From: Owen Taylor <otaylor redhat com>
- To: Evan Hughes <hughes lab43 org>
- Cc: gtk-list gnome org
- Subject: Re: Threads and updating.
- Date: 18 May 2000 19:11:00 -0400
Evan Hughes <email@example.com> writes:
> I'm having some difficulty with getting GTK widgets (namely a CList) to
> update in a multithreaded app.
> There are two threads, the original thread that GTK is running on, and a
> second that talks to openslp. Occasionally, the openslp thread adds a new
> entry to a CList in GTK's thread.
> The problem is that the new entries aren't drawn until the user does
> something to prompt a redraw. In other words, the items don't appear
> unless I move the mouse pointer to a new widget or hit a key.
> Is there some way to force the CList to redraw from a non-GTK thread? All
> of my calls to GTK are wrapped in gdk_threads_enter() and
> (I've tried whacking the CList with gtk_widget_show and
> gtk_widget_show_now, but to no avail. I don't know what these do, but they
> sounded promising =)
Probably you just need to do a gdk_flush() after finishing doing
your stuff from the non-main loop.
X requests are queued up, and need to be flushed out. Normally,
(or actually Xlib) GDK flushes before waiting for more events
to come in, but if you are not going back and waiting for
more events (because the main thread is doing that), then you
need to flush explicitely.
] [Thread Prev