Re: A question about threads
- From: "Jim George" <jimgeorge gmail com>
- To: gtk-app-devel-list gnome org
- Subject: Re: A question about threads
- Date: Mon, 11 Dec 2006 06:24:17 -0700
If you use the threads approach and want to make your app portable to
other platforms, you should use the g_thread library. pthreads will
only work under Linux. The biggest problem of using threads is that
the secondary threads must not try to directly update the GUI, unless
you use g_threads_enter/leave, but that (in my limited experience)
doesn't always seem to help (I've seen random crashes, with messages
about asynchronous X messages). You can use a GAsyncQueue to pass data
between the thread and an idle handler which does the actual GUI
updates (I've posted about this a while back). I suppose one advantage
of using threads to do the calculation (as opposed to an idle
callback) is that the app will run smoother on a dual core/dual
processor machine.
-Jim
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]