Re: Still confused on new thread starting idle functions to update UI.
- From: Chris Angelico <rosuav gmail com>
- To: gtk-app-devel-list list <gtk-app-devel-list gnome org>
- Subject: Re: Still confused on new thread starting idle functions to update UI.
- Date: Wed, 4 Dec 2013 21:40:07 +1100
On Wed, Dec 4, 2013 at 9:28 PM, Chris Vine <chris cvine freeserve co uk> wrote:
Otherwise, have you considered perhaps using something like the python
bindings for GTK+? These have a binding for g_idle_add() and handle
all the memory allocation for you. I recommend using the
gobject-introspection binding for GTK+-3 rather than the old pygtk for
GTK+-2. Python is another language which is worth learning. There are
also introspection bindings for javascript if you prefer that (although
you won't be able to use threads in javascript - but that may be an
advantage for you).
I second the recommendation for Python. And if you like the idea of a
high level language (in which strings are strings, not pointers to
blobs of memory that you have to deallocate later) and also like C's
syntax, check out Pike at http://pike.lysator.liu.se/ - an excellent
language, though an obscure one. Currently Pike has GTK2 bindings but
not GTK3 (they're a planned addition, someone just has to do the work,
I guess). You can do threads with either Python or Pike; but for
something like this, I'd be inclined to work asynchronously instead of
with threads. The main thread goes into a back-end loop that handles
everything through callbacks - when a GTK event comes in, code gets
called, and when something happens that creates a new line of
information, code gets called. Unless you actually expect to saturate
one CPU core and need threads so you can make use of a second CPU or
core, this will be ample, and your code will be far FAR easier to get
your head around. Eliminating the headaches of low-level memory
management makes your life enormously easier.
ChrisA
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]