Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 07-20-2004, 07:44 AM   #1
LQ Newbie
Registered: Nov 2003
Posts: 5

Rep: Reputation: 0
GTK multi-threaded application


I am developing a multi-threaded (pthreads) GUI application using GTK 2.0 library on Red Hat Linux 9.0.

Application has 3-4 GUI threads i.e. one window in each of the 3-4 GUI threads.

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?

Can any one help me on this issue?

Thanks in advance.
Old 09-24-2008, 01:37 AM   #2
LQ Newbie
Registered: Oct 2007
Posts: 14

Rep: Reputation: 0
Hi All,

I am also facing the same issue. I am developing a system tray application ,Which will listen to a port for any incoming connection.

Also there is a menu attached with this system tray application, through which user can perform operations.

I have forked a process which will listen to the socket for connection and then perform operations and in the parent thread I am handling the GUI of system tray by calling gtk_main().

What is happening is at the accept() function the code is getting blocked and now even the parent process is not able to function because of this the menu of system tray hangs.

Plz help.

Arun Tayal

Last edited by arun.tayal; 09-24-2008 at 01:40 AM.
Old 01-20-2009, 04:59 AM   #3
LQ Newbie
Registered: Apr 2008
Posts: 2

Rep: Reputation: 0
Lightbulb use gdk_threads api


Use gdk_threads APIs as follow:

GtkWidget *window;

/* init threads */

/* init gtk */
gtk_init(&argc, &argv);

window = create_window();


and in the other threads, wherever we are calling gtk+ apis, it should be done as follow:



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
fork()'ed or multi threaded socket I/O? thedevilsjester Programming 5 09-24-2008 01:41 AM
multi-threaded sliding window mjl3434 Programming 2 10-24-2005 05:16 PM
how to do waitpid() using a multi-threaded server? Thinking Linux - Software 1 04-13-2005 10:50 PM
how to debug multi threaded application sibtay Programming 3 10-15-2004 01:02 PM
Multi-Threaded C pragti Programming 1 06-01-2004 11:50 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:25 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration