[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1249908024.32614.3.camel@johannes.local>
Date: Mon, 10 Aug 2009 14:40:24 +0200
From: Johannes Berg <johannes@...solutions.net>
To: Norbert Preining <preining@...ic.at>
Cc: Marcel Holtmann <marcel@...tmann.org>, linux-kernel@...r.kernel.org
Subject: Re: rfkill rework in 2.6.31-rc, hal/dbus access changes?
On Mon, 2009-08-10 at 14:28 +0200, Norbert Preining wrote:
> And threads I need (AFAIU) because the read from the fd will blcok
> until there is an event, and in the mean time the user might
> do something with the applet (like disabling manually the rfkill,
> or configuration). So one thread is listening to user events (the
> normal pygtk loop) and one is reading from /dev/rfkill and
> in case something comes in it takes the respective actions.
>
> In python-speak I do:
>
> fd = os.open("/dev/rfkill", os.O_RDONLY)
> p = select.poll()
> p.register(fd, select.POLLIN | select.POLLHUP)
> n = p.poll()
> if (t == select.POLLIN)
> buf = os.read(fd, 8)
> ....
>
> Isn't that supposed to work like that?
Oh, that's what you mean by polling...
Well, you still don't need threads, since you can just add your fd to
the gtk event loop. You'd probably use
http://library.gnome.org/devel/glib/unstable/glib-IO-Channels.html#g-io-add-watch and http://library.gnome.org/devel/glib/unstable/glib-IO-Channels.html#g-io-channel-unix-new
johannes
Download attachment "signature.asc" of type "application/pgp-signature" (802 bytes)
Powered by blists - more mailing lists