[GTK with threads]



Hello,
 we got a problem with an application we are developing , GTK+ based. It's
a p2p application, based on a protocol similar to gnutella. Actually, it's
quite simple: it's a project for a university course.
Our main() create a pthread for a "server", that is a thread that accepts
connections on a listen socket. This server create a pthread "manager" for
each request arriving: these managers do a read() on a connection socket.
Consider that these threads DO NOT work on gtk widgets (so the GTK lock -
entry and leave - shouldn't be a problem).
The problem is: the application fails abruptly, such in a random way. All
the errors are about gtk, gdk, pango or cairo. We've tried to develop a
server and a manager using processes instead of threads, and in this way,
the application works fine. But we need threads.
The application does its work: if you're lucky, you can see it connect to
the network, get files from remote peers, and so on. It fails in an
unexpected way, at unexpected times.
We initialize the application in this way:

...
   g_thread_init (NULL);
   gdk_threads_init ();
   gdk_threads_enter ();

   gnome_program_init (PACKAGE, VERSION, LIBGNOMEUI_MODULE,
                     argc, argv,
                     GNOME_PARAM_APP_DATADIR, PACKAGE_DATA_DIR,
                     NULL);
...

Could anyone help us?

thank you!

Luca Sangemi
Alessio Barbaccia



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]