Re: [Rhythmbox-devel] plugins and threads



On Mon, 2007-01-10 at 17:49 +0200, Christian Buennig wrote:
> But since I prefer to write my plugin in Python: Does anyone have an
> idea to implement a server plugin without an extra thread? A solution
> might be to let Rhythmbox periodically "tick" my plugin so that the
> plugin can inspects its sockets for incoming data with non-blocking IO,
> but I do not know how to get such a periodic "tick" from Rhythmbox.

To do specifically what you're asking, you can use gobject.idle_add() or
gobject.timeout_add(), which will add set a callback function to be run
when rhythmbox is idle (1st), or after a certain time has passed (2nd).
These functions run in the main thread, so they shouldn't take too long
to execute or the UI will freeze up.

There might be a better way to do this, possibly using the gnomevfs
async functions, although I don't know if they really apply to running a
server.

Hope this helps.

--
Adam Zimmerman <adam_zimmerman sfu ca>

CREATIVITY  - http://mirrors.creativecommons.org/movingimages/Building_on_the_Past.mpg
ALWAYS      - http://www.musiccreators.ca/
BUILDS      - http://www.ubuntu.com/
ON THE PAST - http://www.theopencd.org/
--

Microsoft is not the answer.
Microsoft is the question.
NO (or Linux) is the answer.
		-- Taken from a .signature from someone from the UK, source unknown



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