Re: Multithreaded GTK application
- From: G Hasse <gh raditex se>
- To: Akhil Mehta <akhil2802 rediffmail com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Multithreaded GTK application
- Date: Tue, 24 Aug 2004 07:56:02 +0000
On Fri, Aug 20, 2004 at 05:58:17AM -0000, Akhil Mehta wrote:
Hi,
I am developing a multi-threaded (pthreads) GUI application using GTK
2.0 library on Red Hat Linux 9.0.
You should consider doing a non threaded application. The user interface
(in your case GTK) only want to be notified by "events" that comes from
lets say the keyboard, network layer or some *file discriptor*.
There is very good mechanisms in Unix to watch for evnets on file
descriptors.
select, poll or kernel queues
------------
man kqueue
DESCRIPTION
The kqueue() system call provides a generic method of notifying the
user when an event happens or a condition holds, based on the
results of small pieces of kernel code termed filters. A kevent is
identified by the (ident, filter) pair; there may only be one
unique kevent per kqueue.
-----
Note that you must have a multicpu system to take advantage of
threads. (A theraded application is allways slower than an application
that runs as many processes - in a singel cpu system).
Application has 3-4 GUI threads i.e. one window in each of the 3-4 GUI
threads.
Why not devide your application into several processes. This is
easy to do! And the problem you have will "go away".
I am putting gtk_main() in my main thread for GUI messages handling
for all threads. Is there any way I can process GUI messages in each
of the GUI thread?
If you organize your application differently this problem will not
arise.
Can any one help me on this issue?
Please read "Advanced programming in the UNIX environment" by
Stevens. He have many answers. Ant the GTK program is just
another process.
--
Göran Hasse
----------------------------------------------------------------
Göran Hasse email: gh raditex se Tel: 08-6949270
Raditex AB http://www.raditex.se Fax: 08-4420570
Sickla Alle 7, 1tr Mob: 070-5530148
131 34 NACKA, SWEDEN OrgNr: 556240-0589
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]