Re: [gtk-list] Gtk & multi-thread...



Christopher Lansdown <lansdoct@screech.cs.alfred.edu> writes:

> [snip] One method that I and a friend of mine had thought up was to
> do something like adding the function calls gtk_main_fd_add to add a
> fd that gtk selects() on (I am assuming that gtk_main puts gtk into
> a while loop that selects on the socket to the X server), and a
> gtk_main_fd_handler_add(), to put in functions to deal with the
> added file descriptors (to allow for communication between the
> threads cleanly).  Is something like this already in gtk?

Yes, the functions you describe are available as gdk_input_add:

	gint gdk_input_add (gint              source,
			    GdkInputCondition condition,
			    GdkInputFunction  function,
			    gpointer          data);

and as the name suggests its part of GDK rather than GTK (it's in
gdk.c): source specifies the fd, condition is one of GDK_INPUT_READ,
GDK_INPUT_WRITE, GDK_INPUT_EXCEPTION, function is a pointer to the
handler and data specifies callback data.

regards,
Kristian



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