On Thu, 5 Dec 2013 03:06:59 +1100
Chris Angelico <ros...@gmail.com> wrote:
[snip]
> As promised, here's a simple Pike program that listens for socket
> connections.
> [snip]
> 
> See how much effort goes into
> making sure everything's thread-safe? The same amount, because this
> isn't even threaded - though it will happily handle any number of
> simultaneous clients.

And to make the point for David, you can do the same in the C
GTK+/glib libraries, by abandoning threads and instead setting up an
asynchronous watch on the socket using a GIOChannel with
g_io_channel_add_watch().

However, even better than that is to use gio's high level
GSocketListener and GSocketConnection, and read on the contained
GInputStream asynchronously using g_input_stream_read_async().

Chris
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to