RE : RE : Proper way to provide gtk+ app with asynchronous data?



Sorry, I sent it by mistake. Here is the complete mail. 
HTH,

Olivier

-----Message d'origine-----
De : gtk-list-bounces gnome org [mailto:gtk-list-bounces gnome org] De la part de zze-DEPREZ Olivier FTRD/DMI/SOP
Envoyé : vendredi 9 juillet 2004 08:35
À : Dmitry M. Shatrov; gtk-list gnome org
Objet : RE : Proper way to provide gtk+ app with asynchronous data?


Well, if you meant you have one thread who sends the data (non necessarily graphical, eg: the one on your other machine), and one thread who displays it, you just can create another thread who blocks on a read() call for example: 



int
main()
{
  ...
  pthread_create(&thread_id, NULL, (void *(*)())readStatPaquets, NULL);
  ...
  gdk_threads_enter();
  gtk_main();
  gdk_threads_leave();
}


void
readStatPaquets()
{
  ...
  gdk_threads_enter();

  ... (treatment, read() on a socket for example and then displays it)

  gdk_threads_leave();

}


-----Message d'origine-----
De : gtk-list-bounces gnome org [mailto:gtk-list-bounces gnome org] De la part de Dmitry M. Shatrov Envoyé : jeudi 8 juillet 2004 09:32 À : gtk-list gnome org Objet : Proper way to provide gtk+ app with asynchronous data?


Hello.

I'm going to display graphically data that arrives from another machine. It must be displayed as soon as possible, so periodic polling does not suite my needs. How to implement this properly?

In my case there is one thread which receives data and an UI thread with an event loop, I think about making a new event source (g_source_new, I mean), is it correct or maybe there's a simpler solution?

Thank you.
Dmitry

_______________________________________________
gtk-list mailing list
gtk-list gnome org http://mail.gnome.org/mailman/listinfo/gtk-list
_______________________________________________
gtk-list mailing list
gtk-list gnome org http://mail.gnome.org/mailman/listinfo/gtk-list



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