How to create a glib.Source from Python?
Posted
by
Matt Joiner
on Stack Overflow
See other posts from Stack Overflow
or by Matt Joiner
Published on 2011-01-14T07:46:03Z
Indexed on
2011/01/14
7:54 UTC
Read the original article
Hit count: 229
I want to integrate some asyncore.dispatcher
instances into GLib's default main context.
I figure I can create a custom GSource
that's able to detect event readiness on the various sockets in asyncore.socket_map
. From C I believe this is done by creating the necessary GSourceFuncs
which could involve cheap and non-blocking calls to select, and then handling them using asyncore.read, .write and friends.
How do I actually create a GSource from Python? The class glib.Source is undocumented, and attempts to use the class interactively have been in vain.
Is there some other method that allows me to handled socket events in the asyncore
module without resorting to timeouts (or anything that endangers potential throughput and CPU usage)?
© Stack Overflow or respective owner